Eliminate some uses of reflection via type hints