Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

union value typescript

let myVar : string | number;        //Variable with union type declaration
 
myVar = 100;            //OK
myVar = 'Lokesh';       //OK
 
myVar = true;           //Error - boolean not allowed
Source by howtodoinjava.com #
 
PREVIOUS NEXT
Tagged: #union #typescript
ADD COMMENT
Topic
Name
6+5 =