I'm reading this question & answer, trying to understand why I'm getting the same error even if I've done almost the same.
My original code.
/**
* Shortcut for `Array.from()` static method.
* @param {...any[]} args array-like value
* @returns {Array}
*/
const ArrayFrom = (...args) => Array.from(...args);
// >>ERROR here
export default ArrayFrom;
A spread argument must either have a tuple type or be passed to a rest parameter.ts(2556)
Now after defining with ConstructorParameters
/**
* Shortcut for `Array.from()` static method.
* @param {ConstructorParameters<typeof Array>} args array-like value
* @returns {Array}
*/
const ArrayFrom = (...args) => Array.from(...args);
// >>SAME ERROR here
export default ArrayFrom;
I get the same error, at the same expression. Can anyone please explain?