Phase 7 · TypeScript
TopicsUnion
Part of the Frontend Developer Roadmap.
Summary
A type formed by combining multiple types with `|`, meaning a value can be one of several possible types (e.g. `string | number`).
How to Learn This
- 1Model a function parameter that accepts either a `string` or `number`.
- 2Practice narrowing a union type using `typeof` or `in` checks.
- 3Model a set of related states as a union of object shapes — a 'discriminated union'.
More topics in TypeScript
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — free on the InsideEdge app.