-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
fix(query-core): fix to show type error when queryKey is a wrong type in invalidateQueries #8691
Conversation
… in invalidateQueries
View your CI Pipeline Execution ↗ for commit 475d1e2.
☁️ Nx Cloud last updated this comment at |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8691 +/- ##
===========================================
+ Coverage 46.28% 63.06% +16.78%
===========================================
Files 199 135 -64
Lines 7549 4852 -2697
Branches 1727 1370 -357
===========================================
- Hits 3494 3060 -434
+ Misses 3675 1547 -2128
+ Partials 380 245 -135 |
it('shows type error when queryKey is a wrong type in invalidateQueries', () => { | ||
const queryClient = new QueryClient() | ||
|
||
queryClient.invalidateQueries() | ||
|
||
queryClient.invalidateQueries({ | ||
queryKey: ['1'], | ||
}) | ||
|
||
queryClient.invalidateQueries({ | ||
// @ts-expect-error | ||
queryKey: '1', | ||
}) | ||
|
||
queryClient.invalidateQueries({ | ||
// @ts-expect-error | ||
queryKey: {}, | ||
}) | ||
}) |
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.
I’ve added this test to:
where I’m also re-writing the types for invalidateQueries
and other methods.
the test passes there as well, so I’ll close this PR to avoid the conflicts.
closes #8684
Now, the type error is shown when queryKey is a wrong type in invalidateQueries.