Type alias FalsyProperties<T>

FalsyProperties<T>: Pick<T, {
    [K in Keys<T>]: IsFalsy<T[K]> extends true
        ? K
        : never
}[Keys<T>]>

Extracts falsy properties from an object type T.

Type Parameters

  • T

Example

type T = {
a: string;
b: number;
c: boolean;
d?: string | null;
e: 0;
f: null;
};
type az = FalsyProperties<T>;
// Result: {
e: 0;
f: null;
}