"Under the hood, tsx calls node. This means the Node.js features supported in tsx depend on the Node.js version you have installed."
jauco · 1h ago
Newer versions of node can run typescript directly[1]. The one where types are simply stripped is considered stable[2] (but you can’t use syntax that node doesn’t understand, such as enums).
They’re working on making features work that require some transpilation as well
I love tsx. Lately I’ve been also using bun for the same purpose.
spankalee · 1h ago
Does this just pass the --experimental-strip-types flag to node?
joshuaturner · 22m ago
With node24, no flag needed. These tools are really great and I'm happy to see improvement in the space, but I'm even happier to be able to start getting rid of them with native node improvements.
webstrand · 1h ago
Last I knew, it did the transpilation itself so that it could handle module path resolution manually.
basetensucks · 1h ago
It does more, it also includes a compatibility layer allowing you to require ESM packages in CJS. It's quite handy!
andrus · 1h ago
Don’t recent Node.js releases support this already? require(esm) was back ported to Node.js 20 in February
It seems to be a wrapper for esbuild that transpiles typescript then calls your local node (it doesn't bundle nodejs).
From https://tsx.is/faq :
"tsx: Uses esbuild for fast compilation and does not perform type checking."
From https://tsx.is/node-enhancement :
"Under the hood, tsx calls node. This means the Node.js features supported in tsx depend on the Node.js version you have installed."
They’re working on making features work that require some transpilation as well
[1]: https://nodejs.org/en/learn/typescript/run-natively [2]: https://github.com/nodejs/node/pull/58643