devtypes - v1.1.0
    Preparing search index...

    Type Alias OptionalKeys<T>

    OptionalKeys: { [K in keyof T]-?: {} extends Pick<T, K> ? K : never }[keyof T]

    Extract the keys of optional properties.

    Type Parameters

    • T

      Object type to analyze

    Identifies properties that are optional in the object type, including properties whose value type explicitly allows undefined.

    type Obj = { a: number; b?: string; c: number | undefined; d: boolean };
    type OptKeys = OptionalKeys< Obj >;
    // "b" | "c"