When attempting to refactor
Array.prototype.concat.apply([], [x])
to [].concat(x)
, I encountered the following error message:
No overload matches this call.
Overload 1 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error.
Argument of type 'Moment | [Moment, Moment]' is not assignable to parameter of type 'ConcatArray<never>'.
Type 'Moment' is missing the following properties from type 'ConcatArray<never>': length, join, slice
Overload 2 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error.
Argument of type 'Moment | [Moment, Moment]' is not assignable to parameter of type 'ConcatArray<never>'.
Type 'Moment' is not assignable to type 'ConcatArray<never>'.ts(2769)
I need help understanding what's causing this problem and how best to refactor the code.