Description
This will help us a lot in the semantics validation part (e.g. type mismatches).
It will also help in some model to model checking stuff (e.g. return ok, error according to the type).
There is the Hindler Milner
algorithm that the community is talking about, but it seems a little bit difficult.
This is a very nice explained book about the algorithm, which will help us understand how it works.
There is also this npm library that we could check and this github repo.
I've also found another popular approach to type inference for dynamic language, the abstract interpretation. Pysonar2 is an exmple for this that we could also check. Pysonar2 is an elegant implementation of abstract interpretation for Python. It is used by Google to analyze Python projects. Basically it uses visitor pattern to dispatch evaluation call to relevant AST node. The visitor function transform accepts the context in which current node will be evaluated, and returns the type of current node.