Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

typescript check type of variable

if (fooOrBar instanceof Foo){
  // TypeScript now knows that `fooOrBar` is `Foo`
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #typescript #check #type #variable
ADD COMMENT
Topic
Name
5+6 =