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

refactor: type improvement of useSWRHandler #4075

Merged
merged 2 commits into from
Feb 5, 2025

Conversation

samuel871211
Copy link
Contributor

@samuel871211 samuel871211 commented Jan 26, 2025

Instead of using type assertion

return { ... } as SWRResponse<Data, Error>;

Creating a new object with explicit type annotation provides better type safety

const swrResponse: SWRResponse<Data, Error> = { ... };
return swrResponse;

Copy link

codesandbox-ci bot commented Jan 26, 2025

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.

@huozhi huozhi merged commit f98f715 into vercel:main Feb 5, 2025
7 checks passed
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