I just wish runtimes could take advantage of Typescript, and use type hints in performance improvements. Deno, and bun, currently do not, despite running Typescript "natively".
The problem with TypeScript is that it’s purely “advisory.” The actual shape of the objects at runtime might not match the declared types in the system, and once type-checking is complete, it’s a free-for-all.
That being said, you can use AssemblyScript, which offers a “type hints that optimize” approach. Unlike TypeScript, AssemblyScript is compiled to WebAssembly and leverages type information.
Under the hood, V8 performs its own shape analysis on objects to optimize performance. It’s quite effective and can handle a lot of optimization scenarios, though it would be interesting if V8 could use TypeScript’s type information to pre-seed the optimizer with known object shapes (it does not currently).
Indeed would be interesting. Another one of the downsides of everything running on v8. It just feel it gives people the "wrong" impression, even if it helps (massively) with DX to run TS natively.