Structural vs Nominal Typing
← Back to Advanced Type Features
Two approaches to type compatibility. Structural typing considers types compatible if they have the same shape (fields and methods), while nominal typing requires types to be explicitly declared as related by name. Each offers different tradeoffs for flexibility and safety.
Key Properties
Related
- Structural: TypeScript, Go interfaces
- Nominal: Java, C#