Type alias RequiredOnly<T>

RequiredOnly<T>: Pick<T, RequiredKeys<T>>

pick所有Required属性组成新type

Type Parameters

  • T

Example

interface I {
a: string;
b?: number;
c: boolean | undefined;
}

type T = RequiredOnly<I>; // {a: string; c: boolean | undefined}
type T2 = OptionalKeys<I>; // "b"