Last active
January 17, 2022 10:46
-
-
Save obaranovskyi/fdd3642685188a7e6cedf3e30e989b37 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
function valueCheck(value: string | number) { | |
if (typeof value === "string") { | |
// value has type string | |
} else if (typeof value === "number") { | |
// value has type number | |
} else { | |
value; // value has type never | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment