Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Logic to check if an animal type using type assertion
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