type Paths = { [K in keyof T & string]: T[K] extends object ? Paths : [...Path, K]; }; interface Example { foo: string; bar: { baz: number; qux: { quux: boolean; nested: { value: string; }; }; }; deep: { a: { b: { c: number; }; }; }; } type EPath = Paths;