How to annotate a type that’s a class object (instead of a class instance)?
To annotate an object that is a class, use typing.Type. For example, this would tell the type checker that some_class is class Foo or any of its subclasses: from typing import Type class Foo: … class Bar(Foo): … class Baz: … some_class: Type[Foo] some_class = Foo # ok some_class = Bar # ok some_class = … Read more