it would be nice to support that kind of construction :
functionmyFunction(arr: string|string[]){if(typeofarr==='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.
it would be nice to support that kind of construction :
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.