infinite query matchFulfilled returns wrong type
// api
getInfinityScrollThreads: build.infiniteQuery<GetPostsResponse, Args, number>
// slice
extraReducers: (builder) => {
builder.addMatcher(api.endpoints.getInfiniteQueryPosts.matchFulfilled, (state, action) => {
const payload = action.payload <-- shows up as GetPostsResponse but is actually { pages: GetPostsResponse[], pageParams: number[] }
}
@markerikson Maybe I'm doing something wrong?
No, that's presumably an actual bug - I didn't think to update the types for the matchers there. Thanks for catching this!
No, that's presumably an actual bug - I didn't think to update the types for the matchers there. Thanks for catching this!
same issue:
providesTags: (result: { pages: GetPostsResponse[], pageParams: number[] }) => []
Out in https://github.com/reduxjs/redux-toolkit/releases/tag/v2.6.1 !
@markerikson -
Out in https://github.com/reduxjs/redux-toolkit/releases/tag/v2.6.1 !
I've installed 2.6.1, but I still see wrong types in matchFulfilled. What could be wrong?
@nzaytsev can you share a repro and show what you're expecting to see there?
@markerikson - Unfortunatelly, the original error is in private repo. I created a new repo with the same package versions. It's strange, but at the beginning the error couldn't be reproduced. After some complications it's finally reproduced, but now I cannot identify which step caused this error to be reproduced 😄 I'm sorry for useless report, I'll give you any info if I find any regularity
Here is the repo https://github.com/nzaytsev/repro-rtk-type-error Here is fallen test https://github.com/nzaytsev/repro-rtk-type-error/actions/runs/13849833086/job/38755130320
Hmm, very strange. I'll try to find time to look into it further.