microsoft / TypeScript Public
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unhelpful "Did you forget to include 'void' in your type argument to 'Promise'" in JS file #46570
Comments
Note for repro: this requires setting: "strict": true,
"checkJs": true In your jsconfig |
Minimal repo: new Promise(resolve => resolve()); Can be worked around with a type annotation: /**
* @type {Promise<void>}
*/
(new Promise(resolve => resolve())); |
Moving upstream. The current behavior looks expected for strict mode but I agree the experience is not great. Looks like there is already a quick fix for it though: Some other ideas:
|
Hm interesting, I didn't notice the quick fix, and I see I did have: "js/ts.implicitProjectConfig.checkJs": true,
"js/ts.implicitProjectConfig.strictNullChecks": true, globally configured. So I guess this is pretty reasonable, I'd be fine to just close it out. |
@DanielRosenwasser @rbuckton what should this message even say in JS? We should at least ditch the “did you forget” language, since what we’re asking JS users to do is pretty weird. |
Maybe
|
+JSDoc?
|
Hi all, I'm new here and trying to take this one on. Would appreciate some feedback on the pr (especially around localization) |
@osaimola localization happens automatically after the fact. All you have to do is write the English text in |
TS Template added by @mjbvz
TypeScript Version: 4.5.0-dev.20211028
Search Terms
See #46570 (comment) for more minimal repro
In minimal-hello-world extension sample, using this code:
I see this error:

This isn't really something we should be warning about in JS.
The text was updated successfully, but these errors were encountered: