the tswhy logo: a question mark in a box

tswhy‽

A community effort to enrich TypeScript diagnostics.

Editing TS1044:

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.

TS1044

'{0}' modifier cannot appear on a module or namespace element.

Most modifiers cannot be applied to members in a namespace or ambient module. If you try to add them, you will get an error.

namespace A {
  static const a = 1;
  private const b = 2;
  protected const c = 3;
  private const d = 4;
}

Fix: Remove invalid modifiers.

Remove invalid modifiers:

namespace A {
  const a = 1;
  const b = 2;
  const c = 3;
  const d = 4;
}