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

Missing undefined in 'data' type #2518

Closed
nik-webdevelop opened this issue Mar 20, 2023 · 1 comment
Closed

Missing undefined in 'data' type #2518

nik-webdevelop opened this issue Mar 20, 2023 · 1 comment

Comments

@nik-webdevelop
Copy link

nik-webdevelop commented Mar 20, 2023

Adding config (even empty object) as a third argument to the useSWR hook results in missing undefined in the data type:

const { data } = useSWR<FetchResult>(
  "/url",
  (url) => fetch(url).then((r) => r.json()),
  {}
);

data type is FetchResult but should be FetchResult | undefined

Could be related to this swr issue

Codesandbox

SWR version.
2.1.0

@promer94
Copy link
Collaborator

Fixed in #2506

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

No branches or pull requests

2 participants