Created
January 19, 2023 13:46
-
-
Save ankitskvmdam/3e912bb53d7141c27989bc2b4c2752e5 to your computer and use it in GitHub Desktop.
To get nested key of an Object.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type TNestedKeyOf<T extends object> = { | |
[Key in keyof T]: T[Key] extends object | |
? T[Key] extends RelativeIndexable<any> | |
? Key | |
: // @ts-ignore | |
Key | `${Key}.${TNestedKeyOf<TMakeAllPropertiesRequired<T[Key]>>}` | |
: Key | |
}[keyof T] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment