Skip to content

LiteralUnion

LiteralUnion<T, U> = T | U & Record<never, never>

Defined in: src/types/utilities.ts:19

Allows autocomplete for union values while still accepting any string

Type Parameters

T

T extends U

U

U = string

Example

type Colors = LiteralUnion<'red' | 'blue' | 'green', string>
// Shows autocomplete for 'red', 'blue', 'green' but accepts any string