JavaScript & TypeScript

Union Type

/ˈjuːnjən taɪp/

Definition

A TypeScript type allowing a value to be one of several types — string | number | undefined.

Example in context

"type Status = 'pending' | 'active' | 'cancelled' — the compiler rejects any other string value."

Related terms

Practice this term

Master Union Type in context by working through exercises in the JavaScript & TypeScript module. You'll see the term used in real engineering scenarios with multiple-choice, fill-in-the-blank, and matching drills.

Frequently Asked Questions

What does "Union Type" mean?

A TypeScript type allowing a value to be one of several types — string | number | undefined.

How do you pronounce "Union Type"?

"Union Type" is pronounced /ˈjuːnjən taɪp/.

Can you use "Union Type" in a sentence?

"type Status = 'pending' | 'active' | 'cancelled' — the compiler rejects any other string value."