Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

129
Views
Use ConstructorParameters to create utility for various JavaScript API static methods

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?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!