the tswhy logo: a question mark in a box

tswhy‽

A community effort to enrich TypeScript diagnostics.

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;
}