-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
fix(types): remove duplicate Array condition in MutationKey type #9754
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(types): remove duplicate Array condition in MutationKey type #9754
Conversation
🦋 Changeset detectedLatest commit: bbb0bc2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 19 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughReorders the conditional checks in the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
View your CI Pipeline Execution ↗ for commit bbb0bc2
☁️ Nx Cloud last updated this comment at |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9754 +/- ##
===========================================
+ Coverage 45.75% 59.80% +14.05%
===========================================
Files 200 129 -71
Lines 8403 5618 -2785
Branches 1928 1527 -401
===========================================
- Hits 3845 3360 -485
+ Misses 4111 1954 -2157
+ Partials 447 304 -143 🚀 New features to boost your workflow:
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/query-core/src/types.ts (1)
1073-1079
: Optional: de-duplicate QueryKey/MutationKey logic via a helper typeTo keep these in lockstep, consider extracting the conditional once:
type KeyFromRegister<P extends 'queryKey' | 'mutationKey'> = Register extends { [K in P]: infer TKey } ? TKey extends ReadonlyArray<unknown> ? TKey : TKey extends Array<unknown> ? TKey : ReadonlyArray<unknown> : ReadonlyArray<unknown> export type QueryKey = KeyFromRegister<'queryKey'> export type MutationKey = KeyFromRegister<'mutationKey'>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/query-core/src/types.ts
(1 hunks)
🔇 Additional comments (1)
packages/query-core/src/types.ts (1)
1073-1079
: LGTM: MutationKey now mirrors QueryKey and removes the redundant branchChecks ReadonlyArray first, then Array, else falls back to ReadonlyArray — identical to QueryKey. This addresses the prior review ask and keeps behavior consistent.
Per previous review comment.
🎯 Changes
This PR removes a duplicated conditional branch in the
MutationKey
type definition.Previously,
Array<unknown>
was checked twice, which caused redundant type logic.✅ Checklist
pnpm run test:pr
.🚀 Release Impact
Summary by CodeRabbit