• Error
  • Reported by the binder

TS1214

Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode.

A word reserved in strict mode (such as `let`, `static` or `yield`) is used as a name in a module. Pick another name.

What it means

Modules always run in strict mode, and strict mode reserves a few extra words: implements, interface, let, package, private, protected, public, static and yield. Using one of them as a variable, function or parameter name in a file with import or export is reported here.

Example

index.ts
export {};
const yield = 1;
ts-r-check -p tsconfig.json --pretty false ts-r output
index.ts(2,7): error TS1214: Identifier expected. 'yield' is a reserved word in strict mode. Modules are automatically in strict mode.

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

  • Rename the binding, for example yieldValue instead of yield.