Here's my memoized global selector from rtk slice
export const selectPostsByUser = createSelector(
[selectAllPosts, (state, userId: number) => userId],
(posts, userId) => posts.filter((post) => +post.user === userId),
);
Here I call this selector from my component:
const postsForUser = useAppSelector((state) => selectPostsByUser(state, userId));
But TS complains saying: Typescript Reselect error: 'state' is declared but its value is never read.
Ok, I can just pass one parameter userId without first parameter (which is state). But this will not be considered as input selector by createSelector. On the other hand I just need to pass a parameter so why should I pass selector with this parameter?
How can I fix this so TS will stop complaining?