We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
FetcherResponse type, which I believe is retuend by preload is not exported.
preload
In the following code:
import useSWR, { preload, type SWRResponse } from "swr"; export interface MyData {} const myDataSwrKey = "/api/myData"; export const useMyData = (): SWRResponse<MyData> => { return useSWR<MyData>(myDataSwrKey, { fetcher: fetch, onError: (err) => { console.error(err); } }); }; export const preloadMyData = () => preload<MyData>(myDataSwrKey, fetch);
I have a generic usage of useSWR. I like to type exported values explicitly, so I add SWRResponse<MyData> to useMyData.
SWRResponse<MyData>
useMyData
I would also like to annotate preloadMyData but FetcherResponse it returns is not exported from "swr", so I my IDE imports
preloadMyData
FetcherResponse
import { FetcherResponse } from "swr/_internal";
Which is _internal so I probably should not use it.
_internal
Please, export FetcherResponse.
SWR version: 2.2.5
(the bug template kinda doesn't work, sorry)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Bug report
FetcherResponse type, which I believe is retuend by
preload
is not exported.Description / Observed Behavior
In the following code:
I have a generic usage of useSWR. I like to type exported values explicitly, so I add
SWRResponse<MyData>
touseMyData
.I would also like to annotate
preloadMyData
butFetcherResponse
it returns is not exported from "swr", so I my IDE importsWhich is
_internal
so I probably should not use it.Please, export
FetcherResponse
.SWR version: 2.2.5
(the bug template kinda doesn't work, sorry)
The text was updated successfully, but these errors were encountered: