Some native angular functions return a ReadonlyArray. Some native angular callbacks pass ReadonlyArrays. Since my typescript code may be called in many ways, I don't want to require all arrays passed to my functions be ReadonlyArrays.
Hence I need to convert a ReadonlyArray to a javascript native array, [].
The simplest way to convert the ReadonlyArray to any[] is to use one of the available methods of ReadonlyArray.
For this we will use concat(). Calling concat with no parameters on a ReadonlyArray will return an [].
You can view other ReadonlyArray members here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With