Use type identifiers instead of using string type hints.
Historically, string type annotations catered for the case where a function on line 5 returns an instance of a class that that is defined at line 7: how can type annotations on line 5 refer to a class that has not been defined yet?
Python 3.7 solved this problem by introducing postponing evaluation of type annotations until Python is ready to use them, removing the need to use string annotation styles.
Function annotations and variable annotations don't evaluate at function definition time. Instead, under the hood they are preserved in
__annotations__ in string form.
This deferring allows forward references: type hints can contains names that have not been defined yet.
If our GitHub code review bot spots this issue in your pull request it gives this advice: