Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 512 Bytes

File metadata and controls

45 lines (32 loc) · 512 Bytes

typelab / utils / UnionPop

type UnionPop<T> = Exclude<T, UnionLast<T>>;

Removes the last type from a union.

⚠️ Does not guarantee correct order.

Type Parameters

Type Parameter Description

T

The union type.

Returns

A new union with the last type removed.

Example

// 'a' | 'b'
type Popped = UnionPop<'a' | 'b' | 'c'>;