Skip to content

Glossary: TypeScript Basics

union type

Also written: union, unions

A type like `number | string` that allows a value of either type. Inside a function you may only do what works for every member, until you narrow it.

Where the book teaches it

Related terms

narrowingmember (of a union)literal type