Last active
October 9, 2022 23:17
-
-
Save arimariojesus/7fb892df8bf93e673a732b3627b605a1 to your computer and use it in GitHub Desktop.
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
type DeepReturn<T, K extends string = string> = K extends keyof T | |
? T[K] | |
: K extends `${infer TKey}.${infer Rest}` | |
? TKey extends keyof T | |
? DeepReturn<Exclude<T[TKey], undefined>, Rest> | |
: undefined | |
: undefined; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment