How could I realize a function that
- takes an array as argument
- the return type is dependent on the array, for example just returning the same array again
- the argument has a default value
I tried doing this, but am failing at the theoretical possibility of the user specifying a generics argument for the function but not the optional parameter
'[1, 2, 3]' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'any[]'