3 ms·
This is essentially what Python did with its type annotations: add flexible syntax support and a standard library for e.g. Optional[dict], and let external tool
by btown 5y ago
This is essentially what Python did with its type annotations: add flexible syntax support and a standard library for e.g. Optional[dict], and let external tools like Mypy iterate on the actual type checking work.
https://peps.python.org/pep-0484/ https://peps.python.org/pep-0484/
It’s a fair compromise, though now there are two invariants: all untyped JS must be a subset of typed JS, which in turn must be a subset of Typescript. And if a JS builtin like Python’s “typing” module is added to make type definitions easier and standardized, there’s now two ways to define types in Typescript. Which is far from the end of the world… but still will be somewhat controversial.
- Spivak 5y agoAnd it works pretty well except for some minor annoyances about typing things which only exist in the mind of mypy having runtime costs.