Type alias Properties<T>

Properties<T>: {
    [K in Keys<T>]-?: ExcludeNullable<T[K]> extends AnyFunction
        ? never
        : K
}[Keys<T>]

Get the literal names of keys that are propeties, basically anything that's not a method in object type T

Type Parameters

  • T extends object

Example

Properties<{
barBaz: string;
bazBar: Numeric;
bar: () => number;
}> // Result: 'barBaz' | 'bazBar'