Last active
May 22, 2020 14:24
-
-
Save janjakubnanista/ba90c8b472a203f3bc3b030ff0d662d2 to your computer and use it in GitHub Desktop.
Checking for strings and numbers in TypeScript
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
// You can easily extend this example to check for | |
// number, boolean, bigint, Function and symbol types | |
const isString = (value: unknown): value is string => typeof value === 'string'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment