3 ms·
Hasn't Node been able to run TypeScript for a couple of versions? Why's the transpiler needed?
by vmsp 3mo ago
Hasn't Node been able to run TypeScript for a couple of versions? Why's the transpiler needed?
- conartist6 3mo agoIt says "injects polyfills as needed for APIs like `Worker`, `Temporal`, etc"
- zamadatix 3mo agoNode's built-in Typescript support is just for type stripping. That works for a massive amount of TypeScript syntax, but not all of it. It also doesn't bother actually checking the types, just removing them so it runs. You also lose things like tsconfig. This looks to support both the built-in stripping as well as actual TypeScript.
- colinmcd 3mo agoExactly this. TypeScript also ended up being many users' entrypoint to JSX, decorators, etc as it became a catchall transpiler surface so respecting tsconfig is vital here (Node understandably has a policy against this). Plus there are extensionless imports, the "phantom" .js imports (pointing to .ts files), etc. List goes on. Type stripping ends up working out of the box for virtually no real world projects sadly. https://nubjs.com/docs/runtime/typescript https://nubjs.com/docs/runtime/typescript
- chirsz 3mo agoThe Node.js team removed `--experimental-transform-types` from Node.js v26. This makes native, full TypeScript support impossible. https://github.com/nodejs/typescript/issues/51#issuecomment-4421528927 https://github.com/nodejs/typescript/issues/51#issuecomment-...