Yeah, bun for example can execute typescript files directly. It does not include the tsc or anything, it just strips out type annotations and executes the remanining file that is valid JS.
esbuild does the same I believe.
>The only place this rule is broken, is TS Enums, and that generally considered to have been a mistake, but one that too old to rectify.
Why is that?
Re:Zed on Linux Is Here
by avianlyric on Friday July 12, 2024 @03:49AM
(#40943478)
Historical accident I think. JS has no enum concept, but early on TS devs believed that enums were an important feature. To TS produces some small JS fragments for every enum to mimic enum behaviour. It’s not exactly a lot of code, or deep woven into the final output, but it is code that doesn’t have exist in the input.
Later I think people realised that enums aren’t that important, and certainly not important enough to break the golden rule. But alas it was too late. Maybe JS will get an enum concept, and then TS can drop its hack. But until then, it’s the one spot where the TS “compiler” produces output code that doesn’t exist in its input.
The only place this rule is broken, is TS Enums, and that generally considered to have been a mistake, but one that too old to rectify.