4 ms·
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 lang
by weinzierl 3y 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.
- okeuro49 3y agoI've found the biggest difference is structural vs. nominal types. https://www.typescriptlang.org/play#example/structural-typing https://www.typescriptlang.org/play#example/structural-typin... It seems particularly suited to dealing with random JSON payloads.
- mirekrusin 3y agoFlow 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.
- za3faran 3y agoJava has intersection types.
- klysm 3y agoBut Java is nominally typed so I’d argue it’s not really the same