Skip to content

Report strict-mode errors for class names eval and arguments - #64682

Open
dmety wants to merge 2 commits into
microsoft:mainfrom
dmety:codex/issue-64661-strict-class-name
Open

dmety wants to merge 2 commits into
microsoft:mainfrom
dmety:codex/issue-64661-strict-class-name

Conversation

@dmety

@dmety dmety commented Oct 7, 2026

Copy link
Copy Markdown

Fixes #64661

bindClassLikeDeclaration did not call checkStrictModeEvalOrArguments, so class declarations and expressions named eval or arguments escaped TS1210. Call the check while binding class-like declarations and use the class-specific diagnostic for class names.

Add regression coverage for class declarations, named class expressions, ambient class declarations, and JavaScript with checkJs.

Validation:

  • Focused Go test passed: go -C ./tsc test '-run=TestLocal/(strictModeEvalOrArgumentsInClassName|strictModeReservedWordInClassDeclaration|argumentsReferenceInMethod4_Js)' ./internal/testrunner
  • npx hereby test, npx hereby lint, and npx hereby check:format were not run.

Copilot AI balanced review requested due to automatic review settings October 7, 2026 23:38
@typescript-automation typescript-automation Bot added For Backlog Bug PRs that fix a backlog bug labels Oct 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The unconditional check incorrectly rejects erased ambient class declarations.

1 open finding
What changed in this PR

Adds strict-mode diagnostics for class names eval and arguments.

Changes:

  • Checks class names during binding.
  • Adds compiler regression coverage and diagnostic baselines.
File Description
tsc/​internal/​binder/​binder.go Adds class-name validation and class-specific diagnostics.
tsc/​testdata/​tests/​cases/​compiler/​strictModeEvalOrArgumentsInClassName.ts Adds regression cases.
tsc/​testdata/​baselines/​reference/​compiler/​strictModeEvalOrArgumentsInClassName.errors.txt Records diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​strictModeEvalOrArgumentsInClassName.symbols Records symbols.
tsc/​testdata/​baselines/​reference/​compiler/​strictModeEvalOrArgumentsInClassName.types Records inferred types.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment thread tsc/internal/binder/binder.go Outdated

func (b *Binder) bindClassLikeDeclaration(node *ast.Node) {
name := node.Name()
b.checkStrictModeEvalOrArguments(node, name)
@dmety

dmety commented Oct 8, 2026

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

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

2 participants