asArray
asArray<
T>(x):T[]
Returns x as array if it is not an array type.
Example
asArray(1)// => [1]
asArray([2, 3, 4])// => [2, 3, 4]Alternatives
Type Parameters
• T
The value type.
Parameters
x
The value to cast.
T | T[]
Returns
T[]
x interpreted as array.