I agree that it has its limits, and that there are better type systems, but compared to JavaScript it’s a night and day experience.
The amount of help and clarity it brings on large codebases has no equivalent in JS world, and even tho I love Scala or Elm they are simply not realistic alternatives to JS for most of the industry.
But I was told that TypeScript was awesome, and the whole industry is moving toward it, so that's what we chose for this project.
Next time I won't choose TypeScript. I'll either stick with vanilla JS and know that I don't have a type system to catch my mistakes, or I'll try one of: Elm, PureScript, Flow, ReScript, ReasonML, Dart, etc.
There are so many choices, and I'm sure the ecosystems for these other choices is absolutely abysmal compared to TypeScript, but I rather reinvent a few wheels than use wheels that look round at first, but aren't.
If TS is an alternative to JS Scala is also. Hard to thing of an argument that doesn't go the same about both languages.
The only real issue is market reach at this point in time.
- Userbase. Hiring Scala developer is insanely harder than hiring JS developers in most of the world
- Worse ecosystem. This ranges from anything like finding libraries to finding help online.
- Generated bundles and performance are very subpar to most compile-to-js languages.
Point three doesn't sound realistic as you can process compiler output further with the usual JS optimizing tools if you wish. So I would like to see some evidence for the stated claim.
If you enjoy your type system being more expressive at the cost of soundness, you should try this language called JavaScript! It lets you express things that you can't in TypeScript!
> Moreover TypeScript's type system is so powerful it actually catches a good number of bugs that Haskell would never catch, because it does control flow analysis by default. For many languages you would need to install a separate static analyser (if one even exists), having CFA as part of type checking in your editor is godlike.
The control flow analysis has nothing at all to do with the soundness of the type system. Kotlin has similar with it's "smart casting," but that doesn't require it to have an intentionally unsound type system.