Created
August 19, 2021 02:02
-
-
Save YouMinTW/cbc156357e3b6c0ffb10cfaaffa904e5 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 Example<T> = T extends Record<string, any> ? keyof T : T; | |
// type T1 = number | keyof string[] | |
type T1 = Example<string[]>; | |
// type T2 = "a" | "b" | |
type T2 = Example<{ a: number; b: string }>; | |
// type T3 = boolean | |
type T3 = Example<boolean>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment