collectype

collectype v0.11.0


collectype / types/utility / ObjectKeys

Type Alias: ObjectKeys<T>

ObjectKeys<T> = { [K in keyof T]: T[K] extends object ? K : never }[keyof T]

Defined in: types/utility.ts:164

Returns the union of keys in T whose value type is object (including optional properties).

Type Parameters

T

T

The object type to inspect.

Example

type A = { foo: object; bar?: object; baz: string };
  type Keys = ObjectKeys<A>; // "foo" | "bar"