Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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;

@codesandbox-ci
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
@samuel871211 samuel871211 deleted the typeImprovement branch April 9, 2025 13:11
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