Performance is really not an issue unless you're doing very CPU-intensive work which you can't offload to a native library for some reason, or you need to scale vertically rather than horizontally (which is even rarer). Compute cost only really starts being a worthwhile optimization target at the "hundreds of billions of requests per day" level, and even then you're not gonna see much of an improvement from moving to Java unless you're actually very good at tuning threadpools (and it might still not be enough of a win compared to whatever else your developers could be doing with that time).
Great type system and language otherwise, though.
Exceptions are a special exception in Typescript because they can come from pretty much anywhere so it can't realistically know the type at compile time.
For everything else you are probably want discrimination unions.
1) 99.9%+ of the time, it'll be an instance of `Error` or some child class.
2) There's a recent compiler flag that's been added which defaults caught errors to `unknown` rather than `any`.
3) You still have access to the same tools to inspect unknown errors as you do everything else - `instanceof`, checking the presence/absence of properties, etc.
It's not great but it's something.
I would actually say the propensity of libraries to use exceptions as control flow and then _fail to document anything about those totally expected outcomes_ is a much bigger headache; that truly is an artifact of its JS inheritance.
Agreed that PHP was the #1 startup language in the Facebook era, then Ruby in the GitHub era, and I think TypeScript now. But while they’re all very productive “early days” languages, TS stays much more productive over time.
Go, Java and Python are all popular startup choices too, but I think TS is the top startup choice right now, and a great choice at that.