devtypes - v1.1.0
    Preparing search index...

    Type Alias Box<T>

    Box: T extends string
        ? String
        : T extends number
            ? Number
            : T extends boolean ? Boolean : T extends symbol ? Symbol : T

    Convert primitive literal types to their boxed object counterparts.

    Type Parameters

    • T

      Primitive literal type(s) to convert

    Useful when interacting with APIs or type constraints that expect boxed primitives instead of their primitive forms.

    type Boxed = Box< 'hello' | 42 | true >;
    // String | Number | Boolean