Created
January 17, 2020 17:48
-
-
Save meekg33k/4210896589fcd894e6daec70c472b002 to your computer and use it in GitHub Desktop.
isCat type guard https://medium.com/p/177b4a654ef6
This file contains hidden or 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
const isCat = (animal: Animal): animal is Cat => { | |
//Hey compiler, this animal is a Cat | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment