-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
fix(query-core): add number, symbol as safe key for OmitKeyof for strictness safely
#7164
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
OmitKeyof for safely
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 7bc46bd. 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 1 targetSent with 💌 from NxCloud. |
OmitKeyof for safelynumber, symbol as safe key for OmitKeyof for strictness safely
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 7bc46bd:
|
number, symbol as safe key for OmitKeyof for strictness safelynumber, symbol as safe key for OmitKeyof for strictness safely
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #7164 +/- ##
==========================================
- Coverage 41.42% 41.15% -0.28%
==========================================
Files 184 182 -2
Lines 7331 7404 +73
Branches 1531 1553 +22
==========================================
+ Hits 3037 3047 +10
- Misses 3889 3945 +56
- Partials 405 412 +7 |
|
@TkDodo @tannerlinsley, In my opinion this is quite simple Pull Request, review this please |
Motivation
TypeScript original Omit's 2nd type parameter's type should be string | number | symbol.
But Error is occured when we use OmitKeyof with 'safely' for object having number | symbol key
Solution
So I update constraint of OmitKeyof's 2nd type parameter when using 'safely' like original Omit's one
export type OmitKeyof< TObject, TKey extends TStrictly extends 'safely' ? | keyof TObject | (string & Record<never, never>) + | (number & Record<never, never>) + | (symbol & Record<never, never>) : keyof TObject, TStrictly extends 'strictly' | 'safely' = 'strictly', > = Omit<TObject, TKey>Expectation
No error when we use OmitKeyof with 'safely' for object having number | symbol key