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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

samuel871211
Copy link

@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

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.

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.

1 participant