Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A challenge with TSX, and as I understand other similar tools, is that it doesn't support TypeScript decorator metadata. A few years ago, libraries using that started to get popular, so many older projects have a significant obstacle to moving away from running the TypeScript compiler JS output.

Starting a new project today, I think the right move is to use TSX or Bun or whatever. You want a roadblock at the very first moment you start trying one of these limited compatibility libraries, Because it won't work and then you'll pick a different library that doesn't rely on non-erasable TypeScript syntax.



The libraries that started to get popular using decorators years ago were using an --experimental compiler flag and should have known better than push that into production usages.

There's a Stage 3 decorators that now compiles in Typescript (>5.0) out of the box without an --experimental compiler flag, but it is subtly incompatible with that old experimental dialect and it will take some time before all those libraries catch up, if they catch up.

It won't run in Node (or this TSX) just yet because I believe Node waits for Stage 4 before enabling language features. (Deno has an experimental flag for it, as Deno supports Stage 3 features behind experimental flags.)


is support not even planned (realistically possible?) in these fast transpilers (like esbuild, used by tsx, right?)


As far as I know the current bottleneck is Decorators are still only Stage 3, so the transpilers can transpile it as is (which I believe esbuild already does), but Node won't support running it until Stage 4.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: