useSWRInfinite has missing types
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 32.5k
- Forks
- 1.4k
- Avg merge
- 28m
- Merged PRs (30d)
- 2
Description
Bug report
When you use useSWRInfinite with pagination based on cursor, getKey callback has type any for previousPageData
Description / Observed Behavior
Expected Behavior
To be correct type same as return type from fetcher
Repro Steps / Code Example
Or share your code snippet or a CodeSandbox link is also appreciated!
Additional Context
SWR version.
v2.2.5
Add any other context about the problem here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the useSWRInfinite entry point and inspect the getKey callback type for previousPageData alongside the fetcher return type. Confirm the expected behavior with a typed cursor-pagination example. Done means previousPageData is inferred as the fetcher’s return type rather than any.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100