• Error
  • Reported by the binder

TS1344

A label is not allowed here.

A label is placed before a declaration or other statement that can't be labelled. Remove the label.

What it means

Labels exist for break and continue. In strict code a label can't be put in front of a function declaration, and a few other positions don't allow one either.

Example

index.ts
export {};
outer: function run() {}
ts-r-check -p tsconfig.json --pretty false ts-r output
index.ts(2,1): error TS1344: A label is not allowed here.

Recorded by node scripts/verify-examples.mjs with ts-r built from commit 6deaf01. The example uses the default tsconfig: strict, target: es2022, module: esnext, moduleResolution: bundler.

How to fix

  • Remove the label. Labels only make sense on loops and blocks you break out of.