openapi-typescript icon indicating copy to clipboard operation
openapi-typescript copied to clipboard

feat(swr-openapi): add custom error types to query builder

Open SSlime-s opened this issue 9 months ago • 3 comments

Changes

close #2136

Added a new Type Parameter, FetcherError, to createQueryHook, createImmutableHook, and createInfiniteHook.

It allows you to include FetcherError to the type of the error in the return value of useQuery.

By default, it is set to never to maintain backward compatibility.

Why this is needed is detailed in issue #2136 .

How to Review

To avoid breaking VSCode syntax highlighting, "<unique-key>" is assigned to a variable before being used in the type argument.

Checklist

  • [x] Unit tests updated
  • [ ] docs/ updated (if necessary)
  • [ ] pnpm run update:examples run (only applicable for openapi-typescript)

SSlime-s avatar Feb 09 '25 10:02 SSlime-s

Deploy Preview for openapi-ts failed.

Name Link
Latest commit 98627826c0f1cb00b706fdb8e294a151696b0c52
Latest deploy log https://app.netlify.com/projects/openapi-ts/deploys/67a889e0904849000847392c

netlify[bot] avatar Feb 09 '25 10:02 netlify[bot]

⚠️ No Changeset found

Latest commit: 98627826c0f1cb00b706fdb8e294a151696b0c52

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Feb 09 '25 10:02 changeset-bot[bot]

Is there anything I should do?

SSlime-s avatar Mar 09 '25 18:03 SSlime-s

This looks great, thank you! Great tests, too! Please add a changeset (see comment) and we can merge and release!

drwpow avatar May 10 '25 14:05 drwpow

Actually since there’s been some time that’s passed since the PR has been open and we’ve been slow to review, I’ll just add the changeset manually so we can get a release out. Thanks!

drwpow avatar May 10 '25 15:05 drwpow