regarding union types: I suppose you can cover the...
# javascript
b
regarding union types: I suppose you can cover the vast array of options using overloading? E.g
Copy code
function x<T>(param: Array<T> | Record<string,strings>)
could be implemented as
Copy code
external fun <T> x(param: Array<T>)
external fun x(param: Record<String, STring>)
correct?
👌 1
✅ 1
t
In common case
ReadonlyArray
instead of
Array
- is what you need. Especially for function parameters
It's like
List
(
ReadonlyArray
) and
MutableList
(
Array
)
b
ah, I understand, I was looking for MutableArray
t
Same situation with
Record
- we have
ReadonlyRecord