structural-typing
Installation
SKILL.md
Get Comfortable with Structural Typing
Overview
TypeScript uses structural typing: if it has the right shape, it fits.
Unlike nominal typing (where types must be explicitly declared), TypeScript checks structure. Understanding this prevents surprises and unlocks powerful patterns.
When to Use This Skill
- Surprised that TypeScript accepts "wrong" values
- Designing interfaces and function parameters
- Writing unit tests with mock objects
- Debugging "impossible" type errors
- Understanding why extra properties are allowed