Skip to content

Conversation

jijiseong
Copy link
Contributor

@jijiseong jijiseong commented Oct 4, 2025

close #5361

use ResolveFullSearchSchema instead of FullSearchSchemaOption

스크린샷 2025-10-04 오후 6 34 23 스크린샷 2025-10-04 오후 6 34 33

search is iffered as correctly

Summary by CodeRabbit

  • Refactor

    • Refined TypeScript typings for route remount dependencies to improve type safety and editor IntelliSense. No runtime behavior changes.
  • Tests

    • Added unit tests to validate direct access to remount dependency search fields.
    • Added type-level tests to ensure the search schema is correctly inferred.

Copy link
Contributor

coderabbitai bot commented Oct 4, 2025

Walkthrough

Updated the type of the remountDeps options' search field in RouteOptionsInterface from FullSearchSchemaOption<TParentRoute, TSearchValidator> to ResolveFullSearchSchema<TParentRoute, TSearchValidator> and added two tests validating the RemountDepsOptions search typing and runtime access. No runtime logic changes.

Changes

Cohort / File(s) Summary
Route options typing update
packages/router-core/src/route.ts
Changed RouteOptionsInterface.remountDeps signature: RemountDepsOptions now expects search to be ResolveFullSearchSchema<TParentRoute, TSearchValidator> instead of FullSearchSchemaOption<...>. No implementation or runtime behavior modified.
Type & runtime tests added
packages/router-core/tests/remountDeps.test-d.ts, packages/router-core/tests/remountDeps.test.ts
Added a TypeScript type-level test asserting RemountDepsOptions search matches the declared schema and a unit test constructing RemountDepsOptions with a search object and asserting property access at runtime.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I twitch my whiskers at types untwined,
No nested search — the shape aligned.
I hop and nibble, tidy and spry,
One field now stands, no echoing cry.
Carrot clap — the typings sigh. 🥕🐇

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues Check ✅ Passed The PR updates the remountDeps signature from FullSearchSchemaOption to ResolveFullSearchSchema and adds both type-level and runtime tests to validate that remountDeps.search is inferred without the extra nested “search” layer, directly fulfilling issue #5361’s requirement for correcting the search shape.
Out of Scope Changes Check ✅ Passed All modifications are confined to the remountDeps type change and associated tests, with no unrelated code or functionality introduced beyond fixing the TypeScript inference issue described in issue #5361.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Title Check ✅ Passed The title “fix(router-core) type infer error in remountDeps” is concise and clearly describes the primary change, namely correcting a TypeScript inference error in the remountDeps API of the router-core package. It accurately reflects the main intent of the pull request without extraneous detail.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jijiseong jijiseong changed the title fix: update type in FilebaseRouteOptionsInterface for improved type r… fix: fix type infer error in remountDeps Oct 4, 2025
@jijiseong jijiseong changed the title fix: fix type infer error in remountDeps fix(tanstack/react-router) type infer error in remountDeps Oct 4, 2025
@schiller-manuel
Copy link
Contributor

thanks for this PR! can you please add a typetest and unit test for this?

@jijiseong
Copy link
Contributor Author

thanks for this PR! can you please add a typetest and unit test for this?

sure! I added tests

Copy link

nx-cloud bot commented Oct 4, 2025

View your CI Pipeline Execution ↗ for commit 6077beb

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 6m 25s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1m 20s View ↗

☁️ Nx Cloud last updated this comment at 2025-10-04 10:41:22 UTC

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/router-core/tests/remountDeps.test-d.ts (1)

11-11: Consider a more precise test name for the type-level assertion.

The test name "search field should be directly accessible" is somewhat ambiguous for a type-level test. Consider a name like "search field type should match SearchSchema exactly" or "search field should not have nested search key" to better reflect that this is testing compile-time type inference rather than runtime accessibility.

packages/router-core/tests/remountDeps.test.ts (1)

5-5: Consider distinguishing the test name from the type test.

Both this runtime test and the type test in remountDeps.test-d.ts use the same name "search field should be directly accessible", but they verify different aspects (runtime vs. compile-time). Consider using a more specific name like "search field value should be directly accessible at runtime" to avoid confusion.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 99463af and 6077beb.

📒 Files selected for processing (2)
  • packages/router-core/tests/remountDeps.test-d.ts (1 hunks)
  • packages/router-core/tests/remountDeps.test.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript in strict mode with extensive type safety across the codebase

Files:

  • packages/router-core/tests/remountDeps.test-d.ts
  • packages/router-core/tests/remountDeps.test.ts
packages/router-core/**

📄 CodeRabbit inference engine (AGENTS.md)

Keep framework-agnostic core router logic in packages/router-core/

Files:

  • packages/router-core/tests/remountDeps.test-d.ts
  • packages/router-core/tests/remountDeps.test.ts
🔇 Additional comments (1)
packages/router-core/tests/remountDeps.test.ts (1)

10-20: LGTM! Test validates runtime behavior correctly.

The test appropriately verifies that the search field is directly accessible at runtime without extra nesting. The mock structure matches the expected RemountDepsOptions type signature, and the assertion confirms the fix addresses the reported issue.

Copy link

pkg-pr-new bot commented Oct 4, 2025

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@5362

@tanstack/directive-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@5362

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@5362

@tanstack/history

npm i https://pkg.pr.new/TanStack/router/@tanstack/history@5362

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@5362

@tanstack/react-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@5362

@tanstack/react-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@5362

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@5362

@tanstack/react-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@5362

@tanstack/react-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@5362

@tanstack/react-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@5362

@tanstack/router-cli

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@5362

@tanstack/router-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@5362

@tanstack/router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@5362

@tanstack/router-devtools-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@5362

@tanstack/router-generator

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@5362

@tanstack/router-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@5362

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@5362

@tanstack/router-utils

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@5362

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@5362

@tanstack/server-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@5362

@tanstack/solid-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@5362

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@5362

@tanstack/solid-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@5362

@tanstack/solid-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@5362

@tanstack/solid-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@5362

@tanstack/start-client-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@5362

@tanstack/start-plugin-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@5362

@tanstack/start-server-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@5362

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@5362

@tanstack/start-storage-context

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@5362

@tanstack/valibot-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@5362

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@5362

@tanstack/zod-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@5362

commit: 6077beb

@jijiseong jijiseong changed the title fix(tanstack/react-router) type infer error in remountDeps fix(router-core) type infer error in remountDeps Oct 4, 2025
@schiller-manuel schiller-manuel changed the title fix(router-core) type infer error in remountDeps fix(router-core): fix typing of search in remountDeps Oct 5, 2025
@schiller-manuel schiller-manuel merged commit b65853e into TanStack:main Oct 5, 2025
6 checks passed
@jijiseong jijiseong deleted the fix/remount-deps-search-type-error branch October 5, 2025 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search is inffred as incorrectly type in remountDeps
2 participants