Nominal Types

This lesson talks about nominal types, a concept that is not part of TypeScript, but can be emulated easily.

Structural vs nominal typing

The majority of programming languages traditionally associated with static typing (Java, C#, C++) follow an approach called nominal typing. In a nominal type system every type is unique. Imagine that you have created two interfaces with exactly the same properties. In TypeScript, it’s perfectly fine to assign an instance of one of these interfaces to a variable typed using the other one. However, in languages with nominal typing, that wouldn’t be possible. TypeScript doesn’t use nominal typing, instead is uses structural typing.

Get hands-on with 1200+ tech skills courses.