Course lesson
Make Primitive Types Incompatible using Typescript Structural Typing
Structural typing is when TypeScript looks at the shape of a type when comparing two different types. We can take advantage of this pattern by extending our type alias with a structural type that makes a primitive number type incompatible with our alias.
- Duration
- 5 min
- Access
- Included
- Transcript
- Retained from source evidence
Structural typing is when TypeScript looks at the shape of a type when comparing two different types. We can take advantage of this pattern by extending our type alias with a structural type that makes a primitive number type incompatible with our alias.
We'll explore how to work with structural types in this lesson!