Lesson 1.112mIntermediate22.1k studentsFree preview
Structural typing and assignability
TypeScript compares shapes, not names. Two unrelated types are interchangeable if their members line up, which explains most surprising assignability errors.
This lesson sits in How the Type System Thinks, part of TypeScript for Application Developers. It assumes what came before it and leads directly into the next lesson in the module.
In this lesson you will
- Compare types by structure rather than declaration
- Read an assignability error from the mismatched member up
- Use branded types when structural compatibility is too loose
Resources
Your notes for this lesson will appear here.