3 ms·
`tsc` is extremely slow to transpile TypeScript sources into JavaScript. It's invaluable for typechecking, but for transpilation there are much better solutions
by franky47 3y ago
`tsc` is extremely slow to transpile TypeScript sources into JavaScript. It's invaluable for typechecking, but for transpilation there are much better solutions like SWC or tsup [1] (which nicely wraps esbuild and Rollup).
[1] https://tsup.egoist.dev/ https://tsup.egoist.dev/
- krona 3y ago> much better solutions like SWC Which doesn't support const enum correctly and god knows what else without erroring.
- arbol 3y agoEsbuild works fine and is also much faster than TSC. Also TS enums are flawed: https://blog.logrocket.com/why-typescript-enums-suck/ https://blog.logrocket.com/why-typescript-enums-suck/
- krona 3y agoNot that I care, but from your article: > Enums in TypeScript are a very useful addition to the JavaScript language when used properly. So, just like any language feature.
- JuanPosadas 3y ago> enums flawed I like Typescript enums generally, my only complaint is that they are kept in the final build as big objects, especially in the scenario where you don't enumerate them. I use a replace function with terser to replace them with inlined constants to make my fine build smaller.
- NoahKAndrews 3y agoThat's what `const enum` is for!
- josteink 3y ago> `tsc` is extremely slow to transpile TypeScript sources into JavaScript That’s because its main job is not transpiling to JS, but as a compiler it actually checks the correctness of the code, which is probably the main reason typescript exists in the first place. You can actually run tsc without emitting JS at all in particular configurations.
- michaelcampbell 3y agoI know this is a "me" thing, but I've come to the point of view that making bits in a different order (eg: classic "compilation" of one language into another) is a very useful side effect of compilers. My main love of them now is as a complete suite of tests with "100%" (some will argue this) code coverage of types, in the languages where that matters. You called functions with what you thought you did, you're getting back what you think you are, you're doing operations on things that actually support them, etc.
- douglaswlance 3y agoWhy do you need it to be fast?