Declare type of useQuery with initialData
Hello!
I have a custom hook that is defined as follow:
Unfortunately, our linting rules require for all functions to have a type defined ðŸ«
When I use the
UseQueryResults
, this does not considers that initialData
is being provided, hence when accessing data
from the hook, this is defined as Todo[] | undefined
.
Do you know how else I can define the hook type so that it knows data is always an array?
Thanks!1 Reply
correct-apricot•14mo ago
do yourself a favour and turn off that lint rule 😂