vtils

Home > types > OptionalKeys

OptionalKeys type

Gets keys of an object which are optional

Signature:

export declare type OptionalKeys<T> = {
    [K in keyof T]-?: undefined extends {
        [K2 in keyof T]: K2;
    }[K]
    ? K
    : never;
}[keyof T];