@karmaniverous/smoz
    Preparing search index...

    Type Alias PropFromUnion<U, K>

    PropFromUnion: Extract<U, Record<K, unknown>>[K]

    Extract the property type K from a union of object types U.

    Type Parameters

    • U

      union of object types

    • K extends PropertyKey

      property key to extract

    type U = { a: number } | { a: string; b: boolean };
    // => number | string
    type A = PropFromUnion<U, 'a'>;