Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
fix(eslint-plugin): [no-misused-promises] check contextual type#10042
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Thanks for the PR,@yeonjuan! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently onhttps://opencollective.com/typescript-eslint. |
netlifybot commentedSep 23, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
✅ Deploy Preview fortypescript-eslint ready!
To edit notification comments on pull requests, go to yourNetlify site configuration. |
nx-cloudbot commentedSep 23, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
☁️ Nx Cloud ReportCI is running/has finished running commands for commit107a125. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 2 targetsSent with 💌 fromNxCloud. |
codecovbot commentedSep 23, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@## main #10042 +/- ##==========================================+ Coverage 88.69% 88.73% +0.04%========================================== Files 426 426 Lines 14829 14884 +55 Branches 4313 4328 +15 ==========================================+ Hits 13153 13208 +55- Misses 1533 1534 +1+ Partials 143 142 -1
Flags with carried forward coverage won't be shown.Click here to find out more.
|
const contextualType = checker.getContextualTypeForArgumentAtIndex( | ||
node, | ||
index, | ||
); | ||
if (contextualType !== type) { | ||
checkThenableOrVoidArgument( | ||
checker, | ||
node, | ||
contextualType, | ||
index, | ||
thenableReturnIndices, | ||
voidReturnIndices, | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
[Bug] We should also do this both for arrays and tuples
declarefunctionfn<Textends(...args:unknown[])=>unknown>(fn:T):voidfn<()=>void>(async()=>{});// reported - okdeclarefunctiontupleFn<Textends(...args:unknown[])=>unknown>(...fns:[T,string,T]):voidtupleFn<()=>void>(async()=>{},'foo',async()=>{});// not reported - bugdeclarefunctionarrayFn<Textends(...args:unknown[])=>unknown>(...fns:(T|string)[]):voidarrayFn<()=>void>(async()=>{},'foo',async()=>{});// not reported - bug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
fn: T, | ||
) => T; | ||
declare const useCallbackReturningVoid: typeof useCallback<ReturnsVoid>; | ||
useCallbackReturningVoid(async () => {}); // correct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
useCallbackReturningVoid(async()=>{});// correct | |
useCallbackReturningVoid(async()=>{}); |
nit :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM, thanks!
b36d524
intotypescript-eslint:mainUh oh!
There was an error while loading.Please reload this page.
PR Checklist
Overview