devtypes - v1.1.0
    Preparing search index...

    Type Alias LiteralUnion<T, U>

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

    Literal union with IntelliSense autocomplete support.

    Type Parameters

    • T extends U

      Union of literal types

    • U = string

      Base type of the literals (defaults to string)

    Creates a union that accepts a set of literal values while still allowing arbitrary values of the base type. This preserves editor autocomplete for the literals without restricting extensibility.

    type Size = LiteralUnion< 'small' | 'medium' | 'large' >;
    // 'small' | 'medium' | 'large' | (string & {})