Comment by weinzierl
3 years ago
I find TypeScript's type system fascinating, especially the intersection types. I wish there was an article contrasting TS's type system with that of other languages and just pointing out the unique to TS parts.
3 years ago
I find TypeScript's type system fascinating, especially the intersection types. I wish there was an article contrasting TS's type system with that of other languages and just pointing out the unique to TS parts.
I've found the biggest difference is structural vs. nominal types.
https://www.typescriptlang.org/play#example/structural-typin...
It seems particularly suited to dealing with random JSON payloads.
Flow supports both nominal types for classes with correct variance and structural types for everything else. This is correct model for js, flow is ahead of typescript in this case.
Java has intersection types.
But Java is nominally typed so I’d argue it’s not really the same