3.6.2 Limitations

Type inference reduces manual type hinting when working with local variables, but sometimes the type system still needs guidance. It will not try to infer the type of a variable or property field unless it has a direct initialization.

There are also cases involving recursion where type inference has limitations. If a function calls itself recursively while its type is not completely known yet, type inference may infer an incorrect and overly specialized type.

Another concern to consider is code legibility. If type inference is overused, parts of a program may become difficult to understand due to the lack of visible types. This is particularly true for method signatures. It is recommended to find a good balance between type inference and explicit type hints.