Port code to issue JS specific error for promises#3653
Merged
ahejlsberg merged 2 commits intomainfrom Apr 29, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
checkJsregression test coveringnew Promise((resolve) => resolve())in a.jsfile. - 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). |
DanielRosenwasser
approved these changes
Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3641.