Class names `eval` and `arguments` are not reported as invalid strict mode bindings
メンテナーはふだん 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
💻 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
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/TypeScript のほかの issue
-
Non-enum CLI options with multiple values separated by comma and space aren't whitespace trimmed対応中かも @auvred が 4 日前に担当しました。 オープンBug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
microsoft/TypeScript#64618 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Needs Investigation
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
microsoft/TypeScript#64565 · リアクション 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
`EFNoLeadingComments` suppresses synthesized leading comments in tsgo; Strada only suppresses source comments対応中かも @weswigham が 7 日前に担当しました。 オープンNeeds Investigation
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
microsoft/TypeScript#64453 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
enhance: Add tests for premature caching of contextual parameter types対応中かも @luchenxu73 が 21 日前に担当しました。 オープンPossible Improvement
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
microsoft/TypeScript#64278 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Docs
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
microsoft/TypeScript#64118 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
microsoft/TypeScript の issue をすべて見る
似ている issue
-
L: github:actions L: php:composer
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
dependabot/dependabot-core#16493 ·
メンテナーはふだん 1 日以内に返信
-
Controller pods on default limits CrashLoopBackOff and constantly reclaim memory対応中かも @brsmnv が今日担当しました。 オープンbug
難易度 2/5 1時間未満 初心者へのやさしさ 68/100
ironcore-dev/ironcore-net#560 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
mark3labs/mcp-go#1039 · コメント 1 件 ·
メンテナーはふだん 8 日以内に返信
-
enhancement
難易度 2/5 1時間未満 初心者へのやさしさ 78/100
JuliusBrussee/caveman#1214 ·
メンテナーはふだん 1 日以内に返信
-
domain/core domain/mail enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
メンテナーはふだん 1 日以内に返信