Union
The structural union type, written (m1, m2, ...mN)
, consists of two or more non-union member types containing all possible values of the member types.
(decimal, String)
Restrictions
- Unions never contain the
*
type. - Unions contain two or more members.
Default value
The default value of an union type is determined as follows:
- If it contains
void
, thenundefined
. - If it contains
null
, thennull
. - No default value.
Nullability
The following shorthands are available for nullability:
T?
or?T
is equivalent to(null, T)
.T!
removesnull
and/orvoid
fromT
.