Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Logic to check if an animal type using type assertion https://medium.com/p/177b4a654ef6
const isCat = (animal: Animal):boolean => {
return (animal as Cat).meow
}
const isDog = (animal: Animal): boolean => {
return (animal as Dog).bark
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment