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
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
exportdefaultclassPCancelable<T>implementsPromiseLike<T>{privatereadonly_promise:Promise<T>;constructor(){this._promise=newPromise(()=>{});}then<TResult1=T,TResult2=never>(onFulfilled?:|((value:T)=>TResult1|PromiseLike<TResult1>)|undefined|null,onRejected?:|((reason:unknown)=>TResult2|PromiseLike<TResult2>)|undefined|null,):Promise<TResult1|TResult2>{returnthis._promise.then(onFulfilled,onRejected);}catch<TResult>(onRejected?:|((reason:unknown)=>TResult|PromiseLike<TResult>)|undefined|null,):Promise<T|TResult>{returnthis._promise.catch(onRejected);}}
ESLint Config
module.exports={"rules":{"@typescript-eslint/promise-function-async":"error"}}
tsconfig
{"compilerOptions": {"strictNullChecks":true }}
Expected Result
exportdefaultclassPCancelable<T>implementsPromiseLike<T>{privatereadonly_promise:Promise<T>;constructor(){this._promise=newPromise(()=>{});}asyncthen<TResult1=T,TResult2=never>(onFulfilled?:|((value:T)=>TResult1|PromiseLike<TResult1>)|undefined|null,onRejected?:|((reason:unknown)=>TResult2|PromiseLike<TResult2>)|undefined|null,):Promise<TResult1|TResult2>{returnthis._promise.then(onFulfilled,onRejected);}asynccatch<TResult>(onRejected?:|((reason:unknown)=>TResult|PromiseLike<TResult>)|undefined|null,):Promise<T|TResult>{returnthis._promise.catch(onRejected);}}
Actual Result
Instead ofasync catch<TResult>(
, the fixer producescatch async <TResult>(
which is invalid syntax.
Additional Info
No response
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin | 5.38.1 |
@typescript-eslint/parser | 5.38.1 |
TypeScript | 4.8.3 |
ESLint | 8.15.0 |
node | web |