Type alias Narrow<TType>

Narrow<TType>: (unknown extends TType
    ? unknown
    : never) | (TType extends Function
    ? TType
    : never) | (TType extends bigint | boolean | number | string
    ? TType
    : never) | (TType extends []
    ? []
    : never) | {
    [K in keyof TType]: Narrow<TType[K]>
}

Infers embedded primitive type of any type

Type Parameters

  • TType

Param: T

Type to infer

Returns

Embedded type of TType

Example

type Result = Narrow<['foo', 'bar', 1]>

Generated using TypeDoc