Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン 初心者向け
#64,661 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
compilers

調査の方向性

binder の bindClassLikeDeclaration から始め、その strict mode チェックを checkStrictModeFunctionName と比較してください。issue には、欠けているチェックと ambient context の条件が示されています。binder の回帰テストを見つけ、クラス宣言、クラス式、および checkJs を有効にした .js ファイルを対象にしてください。eval と arguments というクラス名で期待される strict mode 診断が報告され、有効なケースに変更がないことが完了条件です。

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Go
スター
111k
フォーク
15.5k
平均マージ
1日 21時間
マージ済み PR(30日)
150

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/TypeScript のほかの issue

microsoft/TypeScript の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。