typescript variable is type 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`
}