collectype / types/utility / StringKeys
StringKeys<
T> ={ [K in keyof T]: T[K] extends string ? K : never }[keyofT]
Defined in: types/utility.ts:114
Returns the union of keys in T whose value type is string (including optional properties).
T
The object type to inspect.
type A = { foo: string; bar?: string; baz: number };
type Keys = StringKeys<A>; // "foo" | "bar"