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

docs: type error in react native example #7065

Closed
hichemfantar opened this issue Mar 9, 2024 · 0 comments
Closed

docs: type error in react native example #7065

hichemfantar opened this issue Mar 9, 2024 · 0 comments

Comments

@hichemfantar
Copy link

hichemfantar commented Mar 9, 2024

Describe the bug

The Disable re-renders on out of focus Screens example has a type error 'notifyOnChangeProps' is possibly 'undefined'.ts(18048)

changing it to notifyOnChangeProps?.current turns the error into

Property 'current' does not exist on type '("data" | "error" | "isError" | "isLoading" | "isLoadingError" | "isRefetchError" | "isSuccess" | "status" | "fetchNextPage" | "fetchPreviousPage" | "hasNextPage" | "hasPreviousPage" | ... 18 more ... | "fetchStatus")[] | "all"'.
  Property 'current' does not exist on type '("data" | "error" | "isError" | "isLoading" | "isLoadingError" | "isRefetchError" | "isSuccess" | "status" | "fetchNextPage" | "fetchPreviousPage" | "hasNextPage" | "hasPreviousPage" | ... 18 more ... | "fetchStatus")[]'.ts(2339)

https://tanstack.com/query/v4/docs/framework/react/react-native#disable-re-renders-on-out-of-focus-screens

return notifyOnChangeProps.current

Your minimal, reproducible example

https://tanstack.com/query/v4/docs/framework/react/react-native#disable-re-renders-on-out-of-focus-screens

Steps to reproduce

  1. copy the hook from docs

Expected behavior

no type errors

How often does this bug happen?

None

Screenshots or Videos

No response

Platform

  • macOS

Tanstack Query adapter

React

TanStack Query version

v4.36.1

TypeScript version

v5.1.6

Additional context

No response

@TkDodo TkDodo closed this as completed in 97f274e Mar 11, 2024
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

1 participant