Unsound, inconsistent, overly complicated, poorly abstracted, improper paradigms.....any of those would be a more legitimate criticism than "unsophisticated".
Unsound, inconsistent, overly complicated, poorly abstracted, improper paradigms.....any of those would be a more legitimate criticism than "unsophisticated".
Usually that happens using generic types. They are almost completely worthless in Typescript, and have no analog whatsoever in JS. So you are mucking around just to please the transpiler but adding a type unsafe hack anyway in place of a generic argument.
Typescript should have just stuck with providing checks on type declarations. That's it. Stop adding features from Java/C# when they make no sense in JS.
I would pick another language in a heartbeat, given a choice.
You're right if by "more expressive" you meant "not really safe at all". By using the types of hacks you proposed, you end up losing type information and safety guarantees. So why bother using Typescript in the first place then? Your example is the perfect argument against Typescript.
If you were referring to generic types, then there's no good reason to do that in the first place. Use a base type. Polymorphism 101. Anything else would be duck typing, and not safe.
There's no middle ground with type safety: it is either safe or not. And if there's a chance it's not, then you've lost and all of your efforts are pointless without resorting to manual checks.
And if you were somehow referring to C++ like templating (unlikely), then Typescript doesn't support that anyway.
I think that's a legitimate and, most importantly, factually correct point to make.
If you're interested in what these "Higher-kinded types" are: https://typelevel.org/blog/2016/08/21/hkts-moving-forward.ht...
An HKT encoding using conditional types: https://github.com/pelotom/hkts
Avoid them.
> Unsound, inconsistent, overly complicated, poorly abstracted, improper paradigms
apply to the current stable version of Scala as well. You'd be comparing Typescript as it is in production right now to a best case scenario of where Scala could end up in a couple years.
Probably, but the thing you are doing doesn't accuse TypeScript of being unsophisticated but of having an unsophisticated type system (these are as different as describing a person as being short is different from describing them as having short hair.) And, yeah, a type system that lacks soundness, lacks consistency, is overly complicated and poorly abstracted, and uses improper paradigms can fairly and succinctly be described as unsophisticated compared to one that does not have those shortcomings; the descriptions you point to may be more specific, but are not more legitimate, nor are they more appropriate when the context isn't a detailed dissection of the language.