Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript error in useFilter hook from Query Router Search Params example #5812

Open
tyschroed opened this issue Nov 20, 2024 · 0 comments
Open

Comments

@tyschroed
Copy link

TanStack Table version

8.20.5

Framework/Library version

18.3.1

Describe the bug and the steps to reproduce it

In this example of using Tanstack Router search params via a useFilters hook, there are some type errors when patching the param values.

Type '(prev: { pageIndex?: number | undefined; id?: number | undefined; firstName?: string | undefined; lastName?: string | undefined; age?: number | undefined; pageSize?: number | undefined; sortBy?: `${string}.asc` | ... 1 more ... | undefined; foo?: string | undefined; bar?: number | undefined; }) => { ...; } & Partial...' is not assignable to type 'true | ParamsReducerFn<Router<RootRoute<undefined, {}, AnyContext, AnyContext, {}, undefined, RootRouteChildren, FileRouteTypes>, TrailingSlashOption, boolean, Record<...>, Record<...>>, "SEARCH", string, string | undefined> | undefined'.
  Type '(prev: { pageIndex?: number | undefined; id?: number | undefined; firstName?: string | undefined; lastName?: string | undefined; age?: number | undefined; pageSize?: number | undefined; sortBy?: `${string}.asc` | ... 1 more ... | undefined; foo?: string | undefined; bar?: number | undefined; }) => { ...; } & Partial...' is not assignable to type 'ParamsReducerFn<Router<RootRoute<undefined, {}, AnyContext, AnyContext, {}, undefined, RootRouteChildren, FileRouteTypes>, TrailingSlashOption, boolean, Record<...>, Record<...>>, "SEARCH", string, string | undefined>'.
    Type '{ pageIndex?: number | undefined; id?: number | undefined; firstName?: string | undefined; lastName?: string | undefined; age?: number | undefined; pageSize?: number | undefined; sortBy?: `${string}.asc` | ... 1 more ... | undefined; foo?: string | undefined; bar?: number | undefined; } & Partial<...>' is not assignable to type 'never'.(2322)
link.d.ts(62, 5): The expected type comes from property 'search' which is declared here on type 'NavigateOptions<Router<RootRoute<undefined, {}, AnyContext, AnyContext, {}, undefined, RootRouteChildren, FileRouteTypes>, TrailingSlashOption, boolean, Record<...>, Record<...>>, string, string | undefined, string, "">'
(property) MakeOptionalSearchParams<Router<RootRoute<undefined, {}, AnyContext, AnyContext, {}, undefined, RootRouteChildren, FileRouteTypes>, TrailingSlashOption, boolean, Record<...>, Record<...>>, string, string | undefined>.search?: true | ParamsReducerFn<Router<RootRoute<undefined, {}, AnyContext, AnyContext, {}, undefined, RootRouteChildren, FileRouteTypes>, TrailingSlashOption, boolean, Record<...>, Record<...>>, "SEARCH", string, string | undefined> | undefined```

### Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://stackblitz.com/github/tanstack/table/tree/main/examples/react/query-router-search-params?embed=1&theme=dark&preset=node&file=src/main.tsx

### Screenshots or Videos (Optional)

_No response_

### Do you intend to try to help solve this bug with your own PR?

No, because I do not know how

### Terms & Code of Conduct

- [x] I agree to follow this project's Code of Conduct
- [x] I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant