Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

We accidentally had a regression slip into our TS once that made it take over 7 seconds to typecheck a file, and that was surprisingly painful to diagnose. It meant our CI builds were slower, our local builds were slower, and the language server (in VS code, sublime, etc) would just randomly go unresponsive while editing. If there were tooling to track deltas in that per-file we would have noticed it immediately.


Can you share what was the problem, just in case we have it too?


We had little strings that encoded call signatures, like "iiff" for int int float float. Someone cooked up a way to have typescript validate the strings at build time, but the way it does typechecks against string literals like that seems to cause every string literal in your entire compilation to get validated in advance to figure out whether it could possibly be that specific type. Each possible value - let's say we had 'f', 'i', and 'l' originally and then we added a fourth option for 'd' - caused the typecheck time to magnify by increasing the possible options. IIRC.


I'd bet it had to do with complex templates.

I've had typescript break on me when using libraries like elysia that go full send on their templates.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: