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(openapi-react-query): Fix typing of queryOptions #1952

Merged
merged 1 commit into from
Oct 26, 2024

Conversation

zsugabubus
Copy link
Contributor

Changes

Fixes #1929, #1946. And also fixes an issue with SkipToken and useSuspenseQuery.

How to Review

Added tests that reproduce the bug so if they are correct and green, the linked issues should be fixed.

Checklist

  • Unit tests updated

@zsugabubus zsugabubus requested a review from a team as a code owner October 19, 2024 00:27
Copy link

changeset-bot bot commented Oct 19, 2024

🦋 Changeset detected

Latest commit: bbaf5ac

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
openapi-react-query Patch

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

@zsugabubus
Copy link
Contributor Author

Tests are failing because I bumped react-query (^5.0.0 -> ^5.25.0) to ensure that SkipToken is available.

@drwpow
Copy link
Contributor

drwpow commented Oct 25, 2024

Tests are failing because I bumped react-query (^5.0.0 -> ^5.25.0) to ensure that SkipToken is available.

The tests are failing because the lockfile is out of date. Could you run pnpm i and update the lockfile, and ensure the tests are passing?

@zsugabubus zsugabubus force-pushed the fix-query-options branch 2 times, most recently from 4f88517 to 27ebf7c Compare October 25, 2024 20:20
@zsugabubus
Copy link
Contributor Author

Done.

@drwpow
Copy link
Contributor

drwpow commented Oct 25, 2024

Thanks! This PR looks great, and the tests seem to be passing. Could you add a patch changeset so that this can be released? Thank you!

- Adds `NoInfer` to function return type because starting from
  TypeScript 5.5 it can affect inference. For example:

      const f = <T,>(x: NoInfer<T>) => x;
      const x: number = f('foo');
                          ^^^^^ expects number

  Previous versions could not infer `T` and complained about something
  like "unknown cannot be assigned to number".

  This error is not reproducible with `paths` so we test against a
  minimal paths type.

- Excludes `SkipToken` (introduced in v5.25) from `queryFn` to be
  compatible with `useSuspenseQuery`.
@zsugabubus
Copy link
Contributor Author

Added changeset.

Copy link
Contributor

@drwpow drwpow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@drwpow drwpow merged commit 455b735 into openapi-ts:main Oct 26, 2024
8 checks passed
@openapi-ts-bot openapi-ts-bot mentioned this pull request Oct 26, 2024
@zsugabubus zsugabubus deleted the fix-query-options branch October 26, 2024 10:01
@zsugabubus
Copy link
Contributor Author

It should also fix #1946, I just messed up the syntax. Could you please close that?

@drwpow
Copy link
Contributor

drwpow commented Oct 26, 2024

It should also fix #1946, I just messed up the syntax. Could you please close that?

Oh yes good catch! I personally can never get the syntax right for closing multiple issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
openapi-react-query Relevant to openapi-react-query
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[openapi-react-typescript] discrepency between queryOptions and other hook
2 participants