2 ms·
This is a well explored area. Wikipedia article is short but has some good references [0]. Languages like Haskell, OCaml, F#, and Elm use global type inference
by bcherny 9y ago
This is a well explored area. Wikipedia article is short but has some good references [0].
Languages like Haskell, OCaml, F#, and Elm use global type inference.
Languages like Scala and TypeScript use local type inference. TypeScript in particular uses flowed type inference (there might be a more formal name for this). For example:
let a = document.querySelector('#a') // typeof a is Element | null
if (a == null) throw 'not found' // typeof a is now Element
[0] https://en.wikipedia.org/wiki/Type_inference https://en.wikipedia.org/wiki/Type_inference