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
1: https://www.typescriptlang.org/tsconfig/#erasableSyntaxOnly
[1]: https://www.learningtypescript.com/articles/branded-types
Why? Would you would rather do a smurf naming convention than having your consts, DTOs, events, errors and what not neatly organized under the name of the function that uses it?
This is an interesting development, but it's not really "running TypeScript code" its "almost running TypeScript code".
With alternative runtimes like Deno and Bun able to run real TypeScript code (and type check it, lint it, test it, etc) using a slightly watered-down, not-fully-compatible dialect of TypeScript, just so that it can run on Node without a build step, really isn't a very compelling argument.
It'd be different if TypeScript announced "TypeScript will remove these features to work around Node's limitation — compatibility is more important", but they haven't.
(And I wouldn't personally love it if they did. Deno and Bun are ahead of Node on several different axes, and other runtimes are coming, too — if Node can catch up, then great, but if it can't, then it should rightly be left behind.)
There's still no real alternative to Node for many large frontend apps in production, but for a lot of other TypeScript use cases — build tooling, backend APIs, CLI apps, edge functions — modern TypeScript in the Deno/Bun style (ESM, full filename imports, run/typecheck/lint/test with no user-configured build step) has significant benefits.
Both Deno and Bun have extensive — and necessary — backward compatibility shims to enable interoperability with what I've started calling "legacy Node JS/TS". You can use the Node APIs (but should explicitly import those things with "node:" in your import specifier. You can use NPM packages (even CommonJS ones, although Deno prohibits CommonJS in new code, a stricter line than Bun draws).
I don't think using Deno and Bun is a huge bet on those specific (VC-backed) runtimes, either, because there is a shared vision of what "modern TypeScript" looks like, it works with both of those tools, and I think there will be multiple runtimes that support that vision for as long as TypeScript is relevant, even if both Deno and Bun were to go sideways.
Whether Node itself will become one of those modern runtimes is an interesting question. This is a step in that direction, it looks like, but it's still an open question.
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."
> tsx runs your TypeScript code with modern and sensible defaults, making it user-friendly and especially great for beginners.
You'd still have to worry about config if you want to make adjustment and when that happens, the implicit smart defaults become a friction point.
It might also surprise you with errors when you attempt to bundle the code. It'd be nice to have tsx available at runtime so I can run TypeScript code without worrying about the transpiler
In practice (when using tsx and when using a similar prececessor tech, esrun) ES moves forwards, not backwards.
Is your target "supported node.js and current browsers"? Today's tsx defaults work with that. They'll also work with tomorrows node.js and current browsers.
> From v0.15, esno is essentially an alias of tsx, with automated CJS/ESM mode and caching.
and all issues are now filed in the tsx repo.
Thanks again to the author. It has saved me (and my team) dozens of hours. And I was able to replace all of my ESBuild workarounds that I had made to easily run TypeScript. Cheers.
monarchwadia•6h ago