Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issueenhancement: plugin rule optionNew rule option for an existing eslint-plugin rulelocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: eslint-pluginIssues related to @typescript-eslint/eslint-plugin
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I havesearched for related issues and found none that matched my issue.
- I haveread the FAQ and my problem is not listed.
Playground Link
Repro Code
abstractclassA{thing:number|null=null;abstractsetThing():void;setAndPrintThing():void{this.setThing();console.log(this.thing);}}classBextendsA{// Expected no-misused-promises error hereasyncsetThing():Promise<void>{constthing=awaitfetchThing();this.thing=thing;}}asyncfunctionfetchThing():Promise<number>{returnawaitnewPromise<number>((resolve)=>{setTimeout(()=>{resolve(5);},1000);});}constb=newB();// Prints null instead of 5b.setAndPrintThing();function_setAndPrintThing(setThing:()=>void):void{setThing();console.log(b.thing);}// Correctly triggers no-misused-promises error:// "Promise returned in function argument where a void return was expected"_setAndPrintThing(b.setThing.bind(this));
ESLint Config
{"rules":{"@typescript-eslint/no-misused-promises":"error"}}
tsconfig
{"compilerOptions": {"strictNullChecks":true }}
Expected Result
Line 14 (whereB.setThing
is implemented) should show an error like "Promise returned in abstract method implementation where a void return was expected"
Actual Result
There's no error on line 14
Additional Info
I'm not sure why the playground link doesn't seem to be working, but hopefully you can see my code sample anyway and it makes sense.
Based on theno-misused-promises
page it looks like maybe this should be another category underchecksVoidReturn
?
Metadata
Metadata
Assignees
Labels
accepting prsGo ahead, send a pull request that resolves this issueenhancement: plugin rule optionNew rule option for an existing eslint-plugin rulelocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: eslint-pluginIssues related to @typescript-eslint/eslint-plugin