the tswhy logo: a question mark in a box

tswhy‽

A community effort to enrich TypeScript diagnostics.

Editing TS1034:

All diagnostics and fixes are authored in markdown. Propose any changes by editing the markdown. Additional fixes can be added. A preview of the rendered diagnostic will update when changes are made.

Once all proposed changes are made, the Propose button will submit the information and confirm raising the PR.

TS1034

'super' must be followed by an argument list or member access.

When super appears in a derived class, it must be used, not just left as an empty statement:

class Base {
  method() {
    console.log("Base#method");
  }
}

class A extends Base {
  method() {
    super; // Error
  }
}

Fix: Invoke super as a function.

Utilize super() in the method:

class Base {
  method() {
    console.log("Base#method");
  }
}

class A extends Base {
  method() {
    super();
  }
}

Fix: Access a property of super.

Access some property of the ancestor:

class Base {
  prop = "prop";
}

class A extends Base {
  constructor() {
    console.log(super.prop);
  }
}