type ObjectPath<T> = IsObjectLiteral<T> extends true ? { [K in keyof T]-?: K extends Exclude<PropertyKey, symbol> ? `${K}` | `${K}.${ObjectPath<T[K]>}` : never }[keyof T] : never;Get all of the paths from T as a string union.
| Type Parameter | Description |
|---|---|
|
|
The |
A string union of paths in the object.
type Obj = { a: { b: number }; c: string };
type Paths = ObjectPath<Obj>; // "a" | "a.b" | "c"