TanStack / TanStack/router

ValidateLinkOptions throwing type error when trying to add search params through function.

Open
#5,411 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
15.1k
Forks
1.9k
Avg merge
1d 20h
Merged PRs (30d)
143

Description

Which project does this relate to?

Router

Describe the bug

The search option is throwing a type error when trying to setup linkOptions props. While the code navigates properly, the type is

Your Example Website or App

https://stackblitz.com/edit/tanstack-router-4gmm6ikn?file=src%2Froutes%2Fabout.tsx

Steps to Reproduce the Bug or Issue

Go to About page in code,
Hover type error on

<HeadingLink
  title="Three"
  linkOptions={{
    to: '/posts',
    search: (prev) => ({ ...prev, tag: 'three' }),
  }}
/>
```



### Expected behavior

I expect the search options to work with typesafety as 'to' 'from' etc do

### Screenshots or Videos

_No response_

### Platform

- Router / Start Version: 1.132.47
- OS: MacOS
- Browser: Chrome
- Bundler: vite
- Bundler Version: 7.1.7


### Additional context

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the About page in the linked StackBlitz reproduction and inspect the HeadingLink linkOptions example, then trace the ValidateLinkOptions type involved in the hover error. Reproduce the type error for the search callback while confirming navigation still works. Done means the callback is accepted with type safety like the to and from options.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.