I have a recursively typed object that I want to get the keys of and any child keys of a certain type.
For instance. Below I want to get a union type of:
<
Here's an infinitely recursive solution:
type Paths = T extends RouteList
? keyof T | { [K in keyof T]: Paths }[keyof T]
: never
type ListPaths = Paths // -> "/parent" | "/another" | "/child"
Tested on Typescript v3.5.1. Also you need to remove the type annotation from the list variable as advised by @jcalz.