the tswhy logo: a question mark in a box

tswhy‽

A community effort to enrich TypeScript diagnostics.

Editing TS1036:

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.

TS1036

Statements are not allowed in ambient contexts.

When defining the shape of a module that is just a declaration, statements aren't allowed as the represent "functional" code versus the "shape" of the module. For example the following is an error:

declare module "some-npm-module" {
  export const a = 1;
  a; // Error
}

Fix: Remove statements.

Remove any statements:

declare module "some-npm-module" {
  export const a = 1;
}