check object type typescript code example
Example 1: typescript type object
type Dictionary = {
[key: string]: any
}
Example 2: typescript check type of variable
if (fooOrBar instanceof Foo){
// TypeScript now knows that `fooOrBar` is `Foo`
}
Example 3: typescript get type
if (typeof abc === "number") {
// do something
}