Closed
Description
it would be nice to support that kind of construction :
function myFunction(arr: string | string[]) {
if (typeof arr === 'string') {
arr = [arr]
}
//arr is now string[]
}
It's a common pattern used by library that take options in parameter.
Generally you can pass an array of string or a string if you have a single value, and internally the library will create an array in any case.