Nothing useful to add, except that I was facing similar issues while goofing around with type annotations and mypy.
Didn't come up with any good solutions (yet), but I haven't stopped trying. This is just a "would be nice to have" feature in our setup, so I haven't been able to dedicate much time to it.