Union
The structural union type, written (M1, M2, ...MN)
, consists of two or more member types, containing all possible values of the member types.
(decimal, String)
Default value
The default value of an union type is determined as follows:
- If it contains
void
, thenundefined
. - If it contains a type that accepts
null
, thennull
. - Return the default value of the first member type.