Skip to content

feat(react-query): v5: Export DefinedInitialDataOptions and UndefinedInitialDataOptions - #5794

Closed
david-crespo wants to merge 1 commit into
TanStack:betafrom
david-crespo:export-query-options-types
Closed

david-crespo wants to merge 1 commit into
TanStack:betafrom
david-crespo:export-query-options-types

Conversation

@david-crespo

Copy link
Copy Markdown

I'm upgrading to v5 in my app. Love it. The only issue I've run into is that I have to use the unexported type UndefinedInitialDataOptions to make this helper for the options. I have some wrappers for useQuery that constrain the args to the methods and params of my API, and I want them to take all the options for useQuery except queryKey and queryFn.

/**
 * `queryKey` and `queryFn` are always constructed by our helper hooks, so we
 * only allow the rest of the options.
 */
type UseQueryOtherOptions<T, E = DefaultError> = Omit<
  UndefinedInitialDataOptions<T, E>,
  'queryKey' | 'queryFn'
>

@vercel

vercel Bot commented Jul 27, 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) Jul 27, 2023 5:17pm

@codesandbox-ci

codesandbox-ci Bot commented Jul 27, 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 b0e039d:

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

@nx-cloud

nx-cloud Bot commented Jul 27, 2023 •

Copy link
Copy Markdown

☁️ Nx Cloud Report

CI is running/has finished running commands for commit b0e039d. 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


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@david-crespo david-crespo changed the title v5: Export DefinedInitialDataOptions and UndefinedInitialDataOptions feat(react-query): v5: Export DefinedInitialDataOptions and UndefinedInitialDataOptions Jul 27, 2023
@TkDodo

TkDodo commented Jul 29, 2023

Copy link
Copy Markdown
Collaborator

thanks. there's a slight issue around these types, and we'd need the same for the InfiniteQuery helpers. I'll make a separate PR and I'll include the export once I'm sure things work as they should.

@TkDodo TkDodo closed this Jul 29, 2023
@TkDodo

TkDodo commented Jul 29, 2023

Copy link
Copy Markdown
Collaborator

decided not to rename, but your changes are included here:

@david-crespo

Copy link
Copy Markdown
Author

Thank you!

@david-crespo
david-crespo deleted the export-query-options-types branch July 29, 2023 19:39
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.

2 participants