define type with union ts code example
Example 1: union value typescript
let myVar : string | number; //myVar can store string and number types
Example 2: union value typescript
let myVar : string | number; //Variable with union type declaration
myVar = 100; //OK
myVar = 'Lokesh'; //OK
myVar = true; //Error - boolean not allowed