Created
March 15, 2021 04:01
-
-
Save mscolnick/a44b77b137bec16c309ffea92b5c8f23 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 TypeName<T> = | |
T extends string ? "string" : | |
T extends number ? "number" : | |
T extends boolean ? "boolean" : | |
T extends undefined ? "undefined" : | |
T extends Function ? "function" : | |
"object"; | |
type T0 = TypeName<string>; // "string" | |
type T1 = TypeName<"a">; // "string" | |
type T2 = TypeName<true>; // "boolean" | |
type T3 = TypeName<() => void>; // "function" | |
type T4 = TypeName<string[]>; // "object" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment