Union Type
A Union Type is a type that represents a value that can be one of several types. Union Types are denoted using the |
symbol between each possible type.
let x: string | number;x = 'hello'; // Validx = 123; // Valid
A Union Type is a type that represents a value that can be one of several types. Union Types are denoted using the |
symbol between each possible type.
let x: string | number;x = 'hello'; // Validx = 123; // Valid