Tag Archive

Tag Archives for " union types "

TypeScript – Union types, type guards and type aliases

This entry is part 1 of 4 in the TypeScript series

Union types We can use union types in TypeScript to combine multiple types into one type: let text: string | string[]; Variable text can now be either string or string array which can be pretty handy in some particular cases. Use case in a function: View the code on Gist. You can use union types […]



Continue reading