Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Class names `eval` and `arguments` are not reported as invalid strict mode bindings

Aperta Adatta ai principianti
#64,661 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@dmety ci sta già lavorando.

Dal 7/10/2026.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
compilers

Direzione di ricerca

Inizia nel binder da bindClassLikeDeclaration e confronta i suoi controlli dello strict mode con checkStrictModeFunctionName; l’issue individua il controllo mancante e la condizione del contesto ambient. Trova i test di regressione del binder e copri le dichiarazioni di classe, le espressioni di classe e i file .js con checkJs. Il lavoro è completato quando i nomi di classe eval e arguments generano la diagnostica prevista dello strict mode senza modificare i casi validi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug
Acknowledgement
  • I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.
Comment
🔎 Search Terms

class name eval arguments, class arguments strict mode, TS1210 class name, TS1215 class declaration, checkStrictModeEvalOrArguments class

🕗 Version & Regression Information
  • This is the behavior in every version I tried (4.0.8, 5.0.4, 6.0.2, 7.1.0-dev.20261006.1), and I reviewed the FAQ for entries about strict mode and reserved words
⏯ Playground Link

https://www.typescriptlang.org/play/?ts=6.0.0-dev.20260416#code/MYGwhgzhAEYE4HMCuBbApgOwC4wN4F9ojiiB6U6DAe2jTjirgBpaAPABzWCzQBNoAKgGUAjACYRABgBQoSDDQA3MCGgESGkuUo06DZm07c+g0RJnAqGCFmgBhaAF5ocqLWWqCAbjIVqtekYWNA4uHn5hcSlpXi5wODQXcDclFTVCbX89IMMwk0jzaWltADFGFyoUdngASwgrFhVVKiwACzpoGzga7gBaFCpY6AAjGoxeMYQYeESE9kZwgC5pADMkDG4aq2gVgAoASjVpIlcYABE1aBRd+GR0bAhFylRhukP1DIoC6PxpEPm4LZvNIgA

💻 Code
class arguments {}        // no error, expected TS1210
class eval {}             // no error, expected TS1210
const C = class eval {};  // no error, expected TS1210
declare class eval {} // no error, expected TS1210

// For comparison, all other strict-mode bindings are reported:
function f() {
  class D { m(arguments: number) {} } // TS1210
}
export {};
🙁 Actual behavior

No errors are reported for the class names. The emitted JavaScript is rejected at runtime:

$ node out.js
SyntaxError: Unexpected eval or arguments in strict mode

The same happens in a .js file with checkJs enabled.

🙂 Expected behavior

Each class name eval / arguments should be reported, as other strict mode bindings already are. Per the spec, all parts of a class are strict mode code (ECMA-262 §11.2.2), and it is an early error for a BindingIdentifier in strict mode code to be eval or arguments (§13.1.1). This applies to both class declarations and class expressions.

Additional information about the issue

In the binder, function names (checkStrictModeFunctionName), variable declarations (bindVariableDeclarationOrBindingElement) and parameters (bindParameter) all call checkStrictModeEvalOrArguments. bindClassLikeDeclaration never does, so class names skip this check.

bindWorker already sets inStrictMode = true for ClassDeclaration / ClassExpression before it calls bindClassLikeDeclaration. So a fix could follow checkStrictModeFunctionName: call checkStrictModeEvalOrArguments(node, node.name) in bindClassLikeDeclaration when not in an ambient context.

Found this issue while fixing the same bug in Babel's parser: https://github.com/babel/babel/pull/18315

Lingua principale
Go
Stelle
111k
Fork
15.5k
Merge medio
1g 18h
PR unite (30g)
156

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/TypeScript

Tutte le issue di microsoft/TypeScript

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.