Earlier quoted context omitted.
At least without additional extensions, TypeScript would help less than you think. It just wasn’t designed for the job. As a simple example - TypeScript doesn’t distinguish between integers and floats; they’re all just numbers. So all array accesses need casting. A TypeScript designed to aid static compilation likely would have that distinction. But the big elephant in the room is TypeScript’s structural subtyping. T…
Such Typescript already exists, Static Typescript, https://makecode.com/language Microsoft's AOT compiler for MakeCode, via C++.
[1]: https://www.microsoft.com/en-us/research/publication/static-...