union type syntax
The parens are required. Long discussion here: bugs.ecmascript.org/ticket/308
There is no solid technical reason for requiring parentheses here. They're here because of people's preferences. I don't find them particularly useful here.
Waldemar
When programmers see a type union expression for the first time, and are going to intuitively understand "|" to be an operator, which has a new meaning when applied to types. Programmers routinely use parens around complex expressions that involve multiple operators, for readability and to ensure they didn't make a mistake around operator precedence. But parens are never required in those places, and it would add an odd asymmetry to the language to require them here.
I vote they are dropped unless there is a compelling technical reason, related to machine parsing.
Peter
Now that union type uses "|" instead of "," for the delimiter, could the parentheses be made optional? It seems like parentheses are used elsewhere only for grouping and function calls/definitions.
which should be easily distinguishable from a bitwise OR expression.
Peter