how do i check if the type of a variable is a particular type in typescript code example
Example: typescript check type of variable
if (fooOrBar instanceof Foo){
// TypeScript now knows that `fooOrBar` is `Foo`
}
if (fooOrBar instanceof Foo){
// TypeScript now knows that `fooOrBar` is `Foo`
}