This PR adopts static type hints as per `mypy` recommendations. This
will hopefully clean up the code a little and squash a few type-related
bugs.
Additionally, this will hopefully open up the door to compiling the
project using `mypyc`, which may score us some performance gains without
needing to rewrite the project in an entirely new language.