• Error
  • Reported by the binder

TS1215

Invalid use of '{0}'. Modules are automatically in strict mode.

`arguments` or `eval` is declared or assigned in a module, which strict mode forbids. Use a different name.

What it means

In strict mode, which every module is in, eval and arguments can't be declared, assigned or used as parameter names. A file with import or export is a module, so such a use is reported here.

Example

index.ts
export {};
let eval = 1;
ts-r-check -p tsconfig.json --pretty false ts-r output
index.ts(2,5): error TS1215: Invalid use of 'eval'. 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 variable or parameter.
  • Use rest parameters (...args) instead of assigning to arguments.