You can use typing.get_type_hints() (or __annotations__) to get the type annotations of an object.
@bbelderbos is that very different from type()? Does it provide nested types like List[Dict[str, int]] ? That would be nice…
@rhgrouls it is yes, type just says it's a function.
And yes it works with nested type hints - see image.
@bbelderbos and once you have, typing.get_args() to get the arguments to types like Union.