Home > Blockchain >  A spread argument must either have a tuple type or be passed to a rest parameter. In super call
A spread argument must either have a tuple type or be passed to a rest parameter. In super call

Time:09-30

Code:

export class NumberInput extends HTMLElement {

  constructor(...args: any) {

    super(...args);

Error log :

Error TS2556: A spread argument must either have a tuple type or be passed to a rest parameter.
(anonymous) @ example.js:1

Any suggestion! thanks

CodePudding user response:

Yup, as CaTS says it, ConstructorParameters is the way to go.

export class NumberInput extends HTMLElement {

    constructor(...args: ConstructorParameters<typeof HTMLElement>) {
        super(...args);
    }
}

Playground

  • Related