close
Skip to content

fix(core): Add pageParam type to QueryFunction generic types - #5623

Merged
TkDodo merged 2 commits into
TanStack:mainfrom
mjlyons:query-page-param-type
Jun 27, 2023
Merged

fix(core): Add pageParam type to QueryFunction generic types#5623
TkDodo merged 2 commits into
TanStack:mainfrom
mjlyons:query-page-param-type

Conversation

@mjlyons

@mjlyons mjlyons commented Jun 23, 2023

Copy link
Copy Markdown
Contributor

Although QueryFunctionContext allows setting the pageParam type through generics, QueryFunction uses QueryFunctionContext without exposing this typing functionality. This forces any queryFn typed as a QueryFunction to have an any pageParam. This change adds TPageParam to QueryFunction type, which is passed through to QueryFunctionContext.

This should be backward compatible and only affects typing (not runtime code).

Although QueryFunctionContext allows setting the pageParam type
through generics, QueryFunction uses QueryFunctionContext without
exposing this typing functionality. This forces any queryFn
typed as a QueryFunction to have an `any` pageParam. This change adds
TPageParam to QueryFunction type, which is passed through to
QueryFunctionContext.

This should be backward compatible and only affects typing (not runtime code).
@vercel

vercel Bot commented Jun 23, 2023

Copy link
Copy Markdown

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

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
query ⬜️ Ignored (Inspect) Jun 27, 2023 0:57am

@codesandbox-ci

codesandbox-ci Bot commented Jun 23, 2023

Copy link
Copy Markdown

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 10fd276:

Sandbox Source
@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

@TkDodo

TkDodo commented Jun 24, 2023

Copy link
Copy Markdown
Collaborator

yeah I think we can merge this, but we've also fixed this holistically on v5 where the type of TPageParam will be inferred correctly from the new defaultPageParam option.

@nx-cloud

nx-cloud Bot commented Jun 24, 2023

Copy link
Copy Markdown

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 10fd276. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


🟥 Failed Commands
nx affected --targets=test:lib --base=ddf698604c5bcad1712c3c1d720b34b777ea1260
✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.39 ⚠️

Comparison is base (df37d35) 92.19% compared to head (ed11cec) 91.81%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5623      +/-   ##
==========================================
- Coverage   92.19%   91.81%   -0.39%     
==========================================
  Files         112      101      -11     
  Lines        4294     3908     -386     
  Branches     1127      985     -142     
==========================================
- Hits         3959     3588     -371     
+ Misses        314      299      -15     
  Partials       21       21              
Impacted Files Coverage Δ
packages/query-core/src/queryCache.ts 100.00% <ø> (ø)
packages/query-core/src/notifyManager.ts 95.12% <100.00%> (+5.12%) ⬆️

... and 11 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mjlyons

mjlyons commented Jun 26, 2023

Copy link
Copy Markdown
Contributor Author

@TkDodo wanted to check if there was anything you'd like me to do here? Noticed the react 17 test suite is failing, but appears to be unrelated.

@TkDodo
TkDodo merged commit 390e47b into TanStack:main Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants