Shape-based Typing

Back to Structural vs Nominal Typing

Types are compatible if they have the same structure (fields and methods), regardless of their declared names. TypeScript and Go interfaces use structural typing, enabling duck typing with static safety — if it has the right shape, it fits.

type-systems structural shape