In this Q/A, I have seen a union type definition wrapped into square brackets (edit: the question has been fixed by now). So far, I've only seen union types without square brackets. What is the difference between e.g.:
type UnionA = number | string;
type UnionB = [number | string];
I'm aware of the following meaning of square brackets in TS:
- Array types
T[]
- Object index structrues (see this question)