Skip to content
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): add number, symbol as safe key for OmitKeyof for strictness safely #7164

Merged
merged 31 commits into from May 6, 2024

Conversation

manudeli
Copy link
Contributor

@manudeli manudeli commented Mar 23, 2024

Motivation

TypeScript original Omit's 2nd type parameter's type should be string | number | symbol.

image

But Error is occured when we use OmitKeyof with 'safely' for object having number | symbol key

image

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

image

Copy link

vercel bot commented Mar 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
query ⬜️ Ignored (Inspect) Visit Preview May 6, 2024 6:19am

@manudeli manudeli changed the title types(query-core): add number, symbol as safe key for OmitKeyof for safely types(query-core): add number, symbol as safe key for OmitKeyof for safely Mar 23, 2024
Copy link

nx-cloud bot commented Mar 23, 2024

☁️ Nx Cloud Report

CI 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 target

Sent with 💌 from NxCloud.

@manudeli manudeli changed the title types(query-core): add number, symbol as safe key for OmitKeyof for safely types(query-core): add number, symbol as safe key for OmitKeyof for strictness safely Mar 23, 2024
Copy link

codesandbox-ci bot commented Mar 23, 2024

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:

Sandbox Source
@tanstack/query-example-angular-basic Configuration
@tanstack/query-example-react-basic-typescript Configuration
@tanstack/query-example-solid-basic-typescript Configuration
@tanstack/query-example-svelte-basic Configuration
@tanstack/query-example-vue-basic Configuration

@manudeli manudeli changed the title types(query-core): add number, symbol as safe key for OmitKeyof for strictness safely fix(query-core): add number, symbol as safe key for OmitKeyof for strictness safely Mar 24, 2024
@manudeli manudeli marked this pull request as ready for review March 30, 2024 12:09
@codecov-commenter
Copy link

codecov-commenter commented Apr 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 41.15%. Comparing base (93674fe) to head (0e5199d).
Report is 115 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files

Impacted file tree graph

@@            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     
Components Coverage Δ
@tanstack/angular-query-devtools-experimental ∅ <ø> (∅)
@tanstack/angular-query-experimental 86.69% <87.50%> (+0.23%) ⬆️
@tanstack/eslint-plugin-query 85.29% <100.00%> (ø)
@tanstack/query-async-storage-persister 43.85% <100.00%> (-5.35%) ⬇️
@tanstack/query-broadcast-client-experimental ∅ <ø> (∅)
@tanstack/query-codemods 0.00% <0.00%> (ø)
@tanstack/query-core 92.94% <92.70%> (-0.32%) ⬇️
@tanstack/query-devtools 3.92% <0.00%> (-0.02%) ⬇️
@tanstack/query-persist-client-core 57.73% <ø> (ø)
@tanstack/query-sync-storage-persister 82.50% <ø> (ø)
@tanstack/react-query 92.77% <100.00%> (ø)
@tanstack/react-query-devtools 10.71% <ø> (ø)
@tanstack/react-query-next-experimental ∅ <ø> (∅)
@tanstack/react-query-persist-client 100.00% <ø> (ø)
@tanstack/solid-query 77.74% <ø> (-4.53%) ⬇️
@tanstack/solid-query-devtools ∅ <ø> (∅)
@tanstack/solid-query-persist-client 100.00% <ø> (ø)
@tanstack/svelte-query 62.68% <ø> (ø)
@tanstack/svelte-query-devtools ∅ <ø> (∅)
@tanstack/svelte-query-persist-client 100.00% <ø> (ø)
@tanstack/vue-query 71.04% <ø> (+0.23%) ⬆️
@tanstack/vue-query-devtools ∅ <ø> (∅)

@manudeli
Copy link
Contributor Author

manudeli commented May 5, 2024

@TkDodo @tannerlinsley, In my opinion this is quite simple Pull Request, review this please

@TkDodo TkDodo merged commit 753fbac into TanStack:main May 6, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants