Hacker News new | ask | show | jobs
by david2ndaccount 1362 days ago
The number one problem with typescript is how slow it is. Compiling a 14k line project takes 5s. This is absurdly slow.
3 comments

When you can write a busy beaver machine in the type system, LOC ceases to be a good indicator or how long something should take to typecheck, imo. If you're frustrated with your build, you should use the trace tools on the TS wiki[1] to track down what types are slow to check, so you can attribute the slowness to the appropriate library authors/yourself and decide for yourself if the speed/correctness tradeoff they've made is right for you.

[1]https://github.com/microsoft/TypeScript-wiki/blob/main/Perfo...

My code is straightforward and doesn’t do advanced type operations.
Check your libraries. Some are really trash and mess with Typescript's speed. Material UI comes to mind.
Typescript by itself is just the language. You could try a different typescript compiler like esbuild for example.
> However, esbuild does not do any type checking so you will still need to run tsc -noEmit in parallel with esbuild to check types.
Personally, I find that I don't really need full type checking on every build. For most small changes, the errors shown in vscode are sufficient while editing, and then full type checking can be run occasionally when needed (and in CI of course).
Your IDE can be doing type checks on whatever file(s) you're working on, you can use esbuild or swc to compile to javascript to make sure it runs correctly, and you can periodically use tsc to fully compile and typecheck your entire codebase to catch anything that you somehow missed in the IDE.
You're right, I didn't count with that
Check out vite.