Skip to content

Instantly share code, notes, and snippets.

@8mist
Created November 9, 2022 08:20
Show Gist options
  • Save 8mist/a04cbae774f78b1e53db5335d4b086f8 to your computer and use it in GitHub Desktop.
Save 8mist/a04cbae774f78b1e53db5335d4b086f8 to your computer and use it in GitHub Desktop.
export type RecursiveKeyOf<
TObj,
TPrefix extends string = ''
> = TObj extends Record<string, any>
? {
[K in keyof TObj & string]:
| `${TPrefix}${K}`
| RecursiveKeyOf<TObj[K], `${TPrefix}${K}.`>;
}[keyof TObj & string]
: never;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment