the tswhy logo: a question mark in a box

tswhy‽

A community effort to enrich TypeScript diagnostics.

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