the tswhy logo: a question mark in a box

tswhy‽

A community effort to enrich TypeScript diagnostics.

TS1039

Initializers are not allowed in ambient contexts.

Initializers represent functional code and are invalid in declarations:

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

Fix: Replace with type definition.

Replace the initializer with an appropriate type definition:

declare module "some-npm-module" {
  export let a: number;
}