Re:All I Want for Christmas Is These Seven TypeScript Improv...
by janosdebugs on Sunday December 25, 2022 @11:28PM
(#34134585)
How would Typescript do that while transpiling to JS? It would need to add a whole lot of boilerplate code to the generated JS, slowing the execution down.
[ Parent
| on HN ]
Re:All I Want for Christmas Is These Seven TypeScript Improv...
by samtho on Monday December 26, 2022 @01:13AM
(#34135143)
Does it not already do this? I don’t use TS if I have the choice due to all the runtime complexities, including the endless house-of-cards shimming it does to prop up all the features of TypeScript.
Re:All I Want for Christmas Is These Seven TypeScript Improv...
by consilient on Monday December 26, 2022 @01:25AM
(#34135230)
No, typescript has full type erasure and almost no type-directed emit. The shimming you're seeing is probably the result of tsc downleveling newer javascript features to older browsers: typescript itself has nothing to do with it.
Re:All I Want for Christmas Is These Seven TypeScript Improv...
by janosdebugs on Monday December 26, 2022 @03:28AM
(#34135804)
Try running tsc in ES2020 mode, the output will be surprisingly clean JavaScript. Older versions include a lot of hacks for dynamic module loading, etc.
Re:All I Want for Christmas Is These Seven TypeScript Improv...
by chucklenorris on Monday December 26, 2022 @04:02PM
(#34141836)
Something like typeinfo<T> being inlined into an object describing my type. Totally opt-in, no need for every type to be tracked at runtime.