Skip to content

Port code to issue JS specific error for promises#3653

Merged
ahejlsberg merged 2 commits intomainfrom
fix-3641
Apr 29, 2026
Merged

Port code to issue JS specific error for promises#3653
ahejlsberg merged 2 commits intomainfrom
fix-3641

Conversation

@ahejlsberg
Copy link
Copy Markdown
Member

Fixes #3641.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Ports TypeScript’s JS-specific diagnostic for Promise executor resolve() calls with missing arguments, aligning tsgo error output in checkJs JavaScript files with upstream behavior (Fixes #3641).

Changes:

  • Add a new checkJs regression test covering new Promise((resolve) => resolve()) in a .js file.
  • Update checker arity-error reporting to emit TS2810 (JSDoc-hint message) for the promise-resolve arity case in JS files instead of TS2794 (type-argument message).
  • Add reference baselines (errors/types/symbols) for the new test.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
testdata/tests/cases/compiler/jsPromiseNeedsJSDocHint.ts New regression test reproducing the JS promise resolve() arity scenario.
testdata/baselines/reference/compiler/jsPromiseNeedsJSDocHint.errors.txt Baseline asserting TS2810 is reported for the JS case.
testdata/baselines/reference/compiler/jsPromiseNeedsJSDocHint.types Baseline for type display output for the new test.
testdata/baselines/reference/compiler/jsPromiseNeedsJSDocHint.symbols Baseline for symbol output for the new test.
internal/checker/checker.go Emit TS2810 in JS files for the void-promise resolve arity error (while preserving TS2794 for TS files).

@ahejlsberg ahejlsberg added this pull request to the merge queue Apr 29, 2026
Merged via the queue into main with commit f65feaf Apr 29, 2026
25 checks passed
@ahejlsberg ahejlsberg deleted the fix-3641 branch April 29, 2026 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Behavior difference: Callback-first promise resolve() gives inconsistent error

3 participants