Skip to content

type: move mutate type annotation into useCallback generic#4191

Open
li-jia-nan wants to merge 3 commits into
vercel:mainfrom
li-jia-nan:type-up
Open

type: move mutate type annotation into useCallback generic#4191
li-jia-nan wants to merge 3 commits into
vercel:mainfrom
li-jia-nan:type-up

Conversation

@li-jia-nan
Copy link
Copy Markdown

  • Refactored boundMutate type definition
    • Improved type consistency within hooks
    • No logic changes; purely type-related refactor, confirmed no runtime changes

@codesandbox-ci
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.

Copilot AI review requested due to automatic review settings May 9, 2026 02:28
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors the boundMutate type definition inside the core useSWRHandler implementation by moving the type annotation from the variable declaration to the useCallback generic. This keeps boundMutate typed as SWRResponse<Data, Error>['mutate'] while leaving runtime behavior unchanged.

Changes:

  • Move boundMutate type annotation into useCallback<...> generic to keep the callback result typed correctly.
  • Keep boundMutate’s public type aligned with SWRResponse<Data, Error>['mutate'] without changing the callback body.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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