by cardanome on 9/26/2024, 2:31:00 AM
by thecodrr on 9/25/2024, 10:42:56 PM
You'd already be using source maps in any real-world scenario so I am not sure what's the value proposition here outside of "just for fun, I guess".
The tsc transpilation to lower ES versions is actually really useful when using not-so-recent Node versions. Not to mention this severely restricts TypeScript syntax to "just types" which isn't too bad but it means you now have to worry about yet another thing.
Then there's the ESM & CJS mess. You almost always want to export in both formats which will change a lot of the syntax, so this quickly falls apart for anything serious.
Just use esbuild if you want speed.
by yonran on 9/26/2024, 12:28:22 AM
Cool. Reminds me of a similar program to convert python3 code to python2, which similarly converts the typing into spaces to preserve row and column numbers: https://github.com/abarker/strip-hints.
by Waterluvian on 9/26/2024, 12:56:23 AM
I wish enum was never part of TypeScript. It’s this one odd thing unlike the rest.
Am I forgetting any or is it the only feature that actually generates code rather than just being extra annotation?
by paulddraper on 9/26/2024, 1:24:24 AM
> We refer to the supported subset as Modern TypeScript because it represents nearly all TypeScript syntax, except for those TypeScript-specific features that may be considered legacy or discouraged in some way
> These unsupported TypeScript features already have preferred alternatives:
> Prefix-style type assertions (<type>value) should be replaced with as-style type assertions.
Am I out of date? Does someone know something I don't?
by mridang on 9/26/2024, 9:37:11 AM
Doesn't the new node feature to strip types handle this already? https://nodejs.org/en/learn/typescript/run-natively
I haven't used it as I haven't had a need for it.
by rendall on 9/25/2024, 10:44:55 PM
This is such a simple idea that it seems like it shouldn't work. Pretty nifty.
by MBlume on 9/26/2024, 12:57:02 AM
I'm a little confused about when I'd use this, if I'm quickly iterating on code as I develop it, probably I also want to know whether it type checks, right?
by umvi on 9/25/2024, 10:49:42 PM
> Today, it appears to be the fastest emitter written in JavaScript
JavaScript is really slow though compared to golang. For that reason I prefer esbuild for type-stripping.
by peterldowns on 9/25/2024, 10:49:35 PM
I am shocked to not see a reference to Taylor Swift’s hit song Blank Space anywhere in the article!
Or maybe just use jsdoc at this point and skip the compile step completely. Though i admit it is not as pretty to read but you can get used to it.
Still a nifty new tool though. I wish JS would just allow type declarations at this point. It doesn't need to enforce them, just allow them like Python does. That would be amazing.