Last active
September 22, 2021 11:19
-
-
Save konstantindenerz/eea05ca7757d67fdd749f847bf4fe518 to your computer and use it in GitHub Desktop.
ts: Recursive keyof
This file contains 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 KeyOf<T> = { | |
[K in keyof T & (string | number)]: T[K] extends object ? `${K}` | `${K}.${KeyOf<T[K]>}`: `${K}`; | |
}[keyof T & (string | number)]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://devblogs.microsoft.com/typescript/announcing-typescript-4-1/