You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using useSWRInfinite doesn't provide the proper types because it assumes the type is an array but i'm using a cursor based so the response is different.
type CorrectResponseType = {
transactions: Transaction[]
nextCursor?: string
nextStartDate?: string
}
const value = useSWRInfinite<Transaction>(getKey(params))
but value.data is Transaction[] and if i pass CorrectResponseType then value.data becomes CorrectResponseType[] which is incorrect.
Expected Behavior
to not modify the response and let me decide what it returns.
CorrectResponseTypec should not be transformed as CorrectResponseType[] in the return value.
Repro Steps / Code Example
Or share your code snippet or a CodeSandbox link is also appreciated!
I tried to make a codesandbox but it couldn't find the swr package so the type were not working so i gave up (no time sorry, have to work on things lol)
Additional Context
using "swr": "^2.2.4"
The text was updated successfully, but these errors were encountered:
Bug report
Description / Observed Behavior
using
useSWRInfinite
doesn't provide the proper types because it assumes the type is an array but i'm using a cursor based so the response is different.but value.data is Transaction[] and if i pass
CorrectResponseType
then value.data becomesCorrectResponseType[]
which is incorrect.Expected Behavior
to not modify the response and let me decide what it returns.
CorrectResponseTypec
should not be transformed asCorrectResponseType[]
in the return value.Repro Steps / Code Example
Or share your code snippet or a CodeSandbox link is also appreciated!
I tried to make a codesandbox but it couldn't find the swr package so the type were not working so i gave up (no time sorry, have to work on things lol)
Additional Context
using
"swr": "^2.2.4"
The text was updated successfully, but these errors were encountered: