4 ms·
> Who cares if TypeScript's type system is unsound if it lets you express things that you cannot express in a nominative system like Java's. I get so much more
by ragnese 5y ago
> Who cares if TypeScript's type system is unsound if it lets you express things that you cannot express in a nominative system like Java's. I get so much more productivity out of TypeScript's type system than any other language including "serious" type systems like Haskell's.
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.
- epolanski 5y agoI’ve been using typescript for years, and I’ve rarely met these un soundness issues. 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.
- still_grokking 5y agoWhy is Scala not a realistic alternative to JS? It has perfect JS interop. 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.
- epolanski 5y ago> Why is Scala not a realistic alternative to JS? - 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.
- still_grokking 5y agoPoint one and two are basically the same point, and mirror what was subsumed under "market reach". 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.
- ragnese 5y agoThere are so many choices, though. I haven't tried any of them myself because I hate JavaScript, I hate front-end stuff, and I hate Node, so I try to avoid all of this. 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.