8000 types: Allow auto-import by improving generated types by oosawy · Pull Request #2563 · vercel/swr · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

types: Allow auto-import by improving generated types #2563

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

Merged
merged 1 commit into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion core/use-swr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -693,4 +693,6 @@ export const unstable_serialize = (key: Key) => serialize(key)[0]
* }
* ```
*/
export default withArgs<SWRHook>(useSWRHandler)
const useSWR = withArgs<SWRHook>(useSWRHandler)

export default useSWR
4 changes: 3 additions & 1 deletion immutable/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ export const immutable: Middleware = useSWRNext => (key, fetcher, config) => {
return useSWRNext(key, fetcher, config)
}

export default withMiddleware(useSWR, immutable)
const useSWRImmutable = withMiddleware(useSWR, immutable)

export default useSWRImmutable
4 changes: 3 additions & 1 deletion infinite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,9 @@ export const infinite = (<Data, Error>(useSWRNext: SWRHook) =>
}
}) as unknown as Middleware

export default withMiddleware(useSWR, infinite) as SWRInfiniteHook
const useSWRInfinite = withMiddleware(useSWR, infinite) as SWRInfiniteHook

export default useSWRInfinite

export {
SWRInfiniteConfiguration,
Expand Down
7 changes: 6 additions & 1 deletion mutation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,12 @@ const mutation = (<Data, Error>() =>
* } = useSWRMutation(key, fetcher, options?)
* ```
*/
export default withMiddleware(useSWR, mutation) as unknown as SWRMutationHook
const useSWRMutation = withMiddleware(
useSWR,
mutation
) as unknown as SWRMutationHook

export default useSWRMutation

export {
SWRMutationConfiguration,
Expand Down
0