Extract the property type K from a union of object types U.
K
U
union of object types
property key to extract
type U = { a: number } | { a: string; b: boolean };// => number | stringtype A = PropFromUnion<U, 'a'>; Copy
type U = { a: number } | { a: string; b: boolean };// => number | stringtype A = PropFromUnion<U, 'a'>;
Extract the property type
K
from a union of object typesU
.