2 ms·
Typescript on node is low key amazing on the backend. It’s got a rusty problem though - build times suck on large code bases.
by baq 2y ago
Typescript on node is low key amazing on the backend. It’s got a rusty problem though - build times suck on large code bases.
- zachrip 2y agoDo you mean transpilation time, or typechecking time?
- TheFragenTaken 2y agoI 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".
- mmastrac 2y agoThe 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).
- TheFragenTaken 2y agoIndeed 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.