CommonProps Documentation - v0.1.2
    Preparing search index...

    Type Alias GetUpcastable<T>

    GetUpcastable: T extends string
        ? string
        : T extends number ? number : T extends boolean ? boolean : never

    Gets the primitive base type for a given type.

    Returns the primitive type that a literal can be upcast to. Returns never for non-primitive types.

    Type Parameters

    • T

      The type to get the primitive for

    The primitive base type or never

    type A = GetUpcastable<'hello'>;  // string
    type B = GetUpcastable<42>; // number
    type C = GetUpcastable<true>; // boolean
    type D = GetUpcastable<object>; // never