3 ms·
I wouldn't exactly call what TypeScript has the best type system out there. It's deliberately unsound, doesn't enforce full static type-checking, _and_ doesn't
by filleduchaos 7y ago
I wouldn't exactly call what TypeScript has the best type system out there. It's deliberately unsound, doesn't enforce full static type-checking, _and_ doesn't provide for runtime checks (there are third-party libraries, but if you're bringing up third parties one might as well argue that JavaScript has a great type system because TypeScript exists).
A lot of it is due to the project's overwhelming priority being as easy to interop with JS as possible, but I've found that quite a few of TypeScript's fancier features are sugar that's entirely up to the developer to enforce.
- whsheet 7y agoDisagree. TS' type system is fully featured compared to others and what you described as an disadvantage is actually an advantage or TS' killer feature: you can gradually convert a dynamic code base into a static one where needed. IDK of any other language that allows this.
- filleduchaos 7y agoFully featured compared to what, exactly? If you say Java I might just have to laugh. Obviously the compatibility with JS is TypeScript's "killer feature", but it's a killer feature that has very explicit costs you're ignoring for some reason. You cannot have a truly excellent type system while trying to maintain the level of compatibility with a dynamic, weakly typed language that TypeScript does, something that the language team acknowledges themselves[0]. I don't quite see how one can call a deliberately unsound type system "the best". 0: https://www.typescriptlang.org/docs/handbook/type-compatibility.html https://www.typescriptlang.org/docs/handbook/type-compatibil...
- whsheet 7y agoNot going to discuss this further. You have a dogmatic view on what is an excellent type system.