Skip to content

Conversation

@birkskyum
Copy link
Member

@birkskyum birkskyum commented Dec 17, 2025

Summary by CodeRabbit

  • New Features

    • Server-side routes with dynamic params, middleware-context merging, and multi-method handlers.
    • Improved routing UX: Not Found and error recovery UI, and a Link integration for easier route linking.
    • Base styling with Tailwind and light/dark theme support.
  • Tests

    • End-to-end test suite covering middleware context and HTTP method behavior.
  • Chores

    • New project tooling and config for local dev, build, formatting, and browser testing.

✏️ Tip: You can customize this high-level summary in your review settings.

@birkskyum birkskyum changed the title test(vue-router): server-routes test(vue-start): server-routes Dec 17, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 17, 2025

Walkthrough

Adds a new Vue end-to-end test project under e2e/vue-start/server-routes/ with TanStack Vue Router, server-side file routes (including middleware and dynamic params), router setup and generated route tree, Vite/PostCSS/TS configs, Playwright tests, and small API in the router package to expose a typed Link component.

Changes

Cohort / File(s) Change Summary
Project config & tooling
e2e/vue-start/server-routes/.gitignore, e2e/vue-start/server-routes/.prettierignore, e2e/vue-start/server-routes/package.json, e2e/vue-start/server-routes/tsconfig.json, e2e/vue-start/server-routes/vite.config.ts
Adds E2E project metadata, scripts, TypeScript, Vite config (plugins: tanstackStart, Vue, JSX), and ignore rules for build/artifacts and generated routes.
Playwright
e2e/vue-start/server-routes/playwright.config.ts, e2e/vue-start/server-routes/tests/server-routes.spec.ts
Adds Playwright config with dynamic test server port and dev server lifecycle; adds E2E tests validating middleware-context merging and methods/only-any behavior.
PostCSS & styles
e2e/vue-start/server-routes/postcss.config.mjs, e2e/vue-start/server-routes/src/styles/app.css, e2e/vue-start/server-routes/src/vite-env.d.ts
Configures Tailwind via PostCSS, adds global app CSS with light/dark theming and border rules, and adds URL import type declaration.
Router infra & generated types
e2e/vue-start/server-routes/src/routeTree.gen.ts, e2e/vue-start/server-routes/src/router.tsx, e2e/vue-start/server-routes/src/routes/__root.tsx
Adds large auto-generated route tree with comprehensive FileRoutes types, builds TanStack Vue Router instance with QueryClient and SSR-query integration, and a root route layout including head, error, and not-found handling.
Server-file routes (API)
e2e/vue-start/server-routes/src/routes/api/middleware-context.ts, .../src/routes/api/only-any.ts, .../src/routes/api/params/$foo/$bar.ts, .../src/routes/api/params/$foo/route.ts
Adds server file routes: middleware chain returning merged context, ANY-method handler returning headers/body, and dynamic param GET handlers.
Client routes & components
e2e/vue-start/server-routes/src/routes/index.tsx, .../routes/merge-middleware-context.tsx, .../routes/methods/*, e2e/vue-start/server-routes/src/components/DefaultCatchBoundary.tsx, e2e/vue-start/server-routes/src/components/NotFound.tsx
Adds Home and test pages, methods UI (including client-side queries to server endpoints), DefaultCatchBoundary error component, and a NotFound component.
E2E project infra files
e2e/vue-start/server-routes/.gitignore, .../.prettierignore, other top-level added files
Misc project infra to ignore generated/build files and control prettier.
Vue Router package changes
packages/vue-router/src/link.tsx, packages/vue-router/src/index.tsx, packages/vue-router/src/route.ts
Adds new exported LinkComponentRoute type and integrates a Link component member into Route API (RouteExtensions, RouteApi, Route, RootRoute) with runtime wrapper rendering Link bound to the route’s from/fullPath.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • routeTree.gen.ts (large auto-generated type surface) — verify correctness and module augmentation.
  • router.tsx and SSR-query wiring — check QueryClient/SSR integration and defaults.
  • Playwright config/tests — ensure test server lifecycle, port allocation, and test reliability.
  • packages/vue-router changes — verify type export and Link member implementations for correct typing and runtime import usage.
  • Server middleware chain and handlers — confirm context merging and response headers.

Possibly related PRs

Suggested labels

ssr, package: start-server-core

Suggested reviewers

  • schiller-manuel
  • brenelz

Poem

"I hopped through routes, a tiny fluff of cheer,
Built middleware paths to keep each response near.
Links now point true, and tests dance in a stream,
Vite hums the tune, Playwright checks the dream.
— 🐰"

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'test(vue-start): server-routes' is vague and generic. While it uses the 'test' prefix suggesting test-related changes, it provides minimal context about what is actually being tested or the main purpose of the changeset. Consider using a more descriptive title like 'test: add e2e server-routes test suite for Vue Router' or 'test(e2e): add server-routes project with middleware and HTTP method tests' to better convey the primary change.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch server-routes-vue

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0b31ea6 and 488e336.

📒 Files selected for processing (1)
  • packages/vue-router/src/route.ts (6 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/vue-router/src/route.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Preview
  • GitHub Check: Test

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.

@nx-cloud
Copy link

nx-cloud bot commented Dec 17, 2025

View your CI Pipeline Execution ↗ for commit 488e336

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 51s View ↗

☁️ Nx Cloud last updated this comment at 2025-12-17 19:12:19 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 17, 2025

More templates

@tanstack/arktype-adapter

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

@tanstack/directive-functions-plugin

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

@tanstack/eslint-plugin-router

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/server-functions-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router@6127

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start@6127

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: 488e336

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: 5

🧹 Nitpick comments (6)
e2e/vue-start/server-routes/tsconfig.json (1)

10-10: Consider adding Vite client types for better type support.

For Vite-based projects, it's recommended to include "types": ["vite/client"] in compilerOptions to get proper typing for Vite-specific features like import.meta.env.

Add after line 10:

     "lib": ["DOM", "DOM.Iterable", "ES2022"],
+    "types": ["vite/client"],
     "isolatedModules": true,
e2e/vue-start/server-routes/src/routes/methods/route.tsx (1)

7-14: Consider adding explicit return type for strict TypeScript.

The RouteComponent function lacks an explicit return type annotation. While TypeScript can infer the type, explicit annotations improve type safety and align with strict TypeScript practices.

Apply this diff to add explicit typing:

-function RouteComponent() {
+function RouteComponent(): JSX.Element {
   return (
     <div class="p-8">
       <h1 class="font-bold text-lg">Server Routes Methods E2E tests</h1>
       <Outlet />
     </div>
   )
 }

As per coding guidelines requiring TypeScript strict mode with extensive type safety.

e2e/vue-start/server-routes/src/routes/api/middleware-context.ts (1)

20-26: Consider explicit type annotations for handler parameters.

The GET handler parameters lack explicit type annotations. While TypeScript can infer types from the createFileRoute context, explicit annotations improve code clarity and type safety.

This is a minor improvement suggestion for strict TypeScript practices, though type inference should work correctly here. As per coding guidelines requiring extensive type safety.

e2e/vue-start/server-routes/src/router.tsx (1)

13-14: Minor inconsistency in component references.

DefaultCatchBoundary is passed directly while NotFound is wrapped in an arrow function. For consistency, both could be passed directly:

   defaultErrorComponent: DefaultCatchBoundary,
-  defaultNotFoundComponent: () => <NotFound />,
+  defaultNotFoundComponent: NotFound,

However, the current implementation is functionally correct.

e2e/vue-start/server-routes/src/routes/merge-middleware-context.tsx (1)

7-7: Consider adding a proper type instead of any.

Using ref<any> bypasses TypeScript's type checking. Define an interface for the expected API response shape to improve type safety.

+interface MiddlewareContextResponse {
+  url?: string
+  context?: { testParent?: boolean; test?: boolean }
+  error?: string
+}
+
 const MergeMiddlewareContext = defineComponent({
   name: 'MergeMiddlewareContext',
   setup() {
-    const apiResponse = ref<any>(null)
+    const apiResponse = ref<MiddlewareContextResponse | null>(null)

As per coding guidelines, TypeScript strict mode with extensive type safety is expected.

e2e/vue-start/server-routes/src/routes/methods/only-any.tsx (1)

75-77: Add key prop to mapped elements.

When mapping over arrays in JSX, each element should have a unique key prop to help Vue efficiently update the DOM.

       {HttpMethods.map((method) => (
-        <Test method={method} />
+        <Test key={method} method={method} />
       ))}
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d476a8b and 0b31ea6.

⛔ Files ignored due to path filters (3)
  • e2e/vue-start/server-routes/public/favicon.ico is excluded by !**/*.ico
  • e2e/vue-start/server-routes/public/favicon.png is excluded by !**/*.png
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (27)
  • e2e/vue-start/server-routes/.gitignore (1 hunks)
  • e2e/vue-start/server-routes/.prettierignore (1 hunks)
  • e2e/vue-start/server-routes/package.json (1 hunks)
  • e2e/vue-start/server-routes/playwright.config.ts (1 hunks)
  • e2e/vue-start/server-routes/postcss.config.mjs (1 hunks)
  • e2e/vue-start/server-routes/src/components/DefaultCatchBoundary.tsx (1 hunks)
  • e2e/vue-start/server-routes/src/components/NotFound.tsx (1 hunks)
  • e2e/vue-start/server-routes/src/routeTree.gen.ts (1 hunks)
  • e2e/vue-start/server-routes/src/router.tsx (1 hunks)
  • e2e/vue-start/server-routes/src/routes/__root.tsx (1 hunks)
  • e2e/vue-start/server-routes/src/routes/api/middleware-context.ts (1 hunks)
  • e2e/vue-start/server-routes/src/routes/api/only-any.ts (1 hunks)
  • e2e/vue-start/server-routes/src/routes/api/params/$foo/$bar.ts (1 hunks)
  • e2e/vue-start/server-routes/src/routes/api/params/$foo/route.ts (1 hunks)
  • e2e/vue-start/server-routes/src/routes/index.tsx (1 hunks)
  • e2e/vue-start/server-routes/src/routes/merge-middleware-context.tsx (1 hunks)
  • e2e/vue-start/server-routes/src/routes/methods/index.tsx (1 hunks)
  • e2e/vue-start/server-routes/src/routes/methods/only-any.tsx (1 hunks)
  • e2e/vue-start/server-routes/src/routes/methods/route.tsx (1 hunks)
  • e2e/vue-start/server-routes/src/styles/app.css (1 hunks)
  • e2e/vue-start/server-routes/src/vite-env.d.ts (1 hunks)
  • e2e/vue-start/server-routes/tests/server-routes.spec.ts (1 hunks)
  • e2e/vue-start/server-routes/tsconfig.json (1 hunks)
  • e2e/vue-start/server-routes/vite.config.ts (1 hunks)
  • packages/vue-router/src/index.tsx (1 hunks)
  • packages/vue-router/src/link.tsx (1 hunks)
  • packages/vue-router/src/route.ts (6 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript strict mode with extensive type safety for all code

Files:

  • e2e/vue-start/server-routes/src/vite-env.d.ts
  • packages/vue-router/src/link.tsx
  • packages/vue-router/src/index.tsx
  • e2e/vue-start/server-routes/src/components/DefaultCatchBoundary.tsx
  • e2e/vue-start/server-routes/vite.config.ts
  • e2e/vue-start/server-routes/src/routes/methods/index.tsx
  • e2e/vue-start/server-routes/src/routes/methods/route.tsx
  • e2e/vue-start/server-routes/playwright.config.ts
  • e2e/vue-start/server-routes/src/routes/api/params/$foo/$bar.ts
  • e2e/vue-start/server-routes/src/router.tsx
  • e2e/vue-start/server-routes/src/routes/merge-middleware-context.tsx
  • e2e/vue-start/server-routes/src/routes/methods/only-any.tsx
  • e2e/vue-start/server-routes/src/routes/__root.tsx
  • packages/vue-router/src/route.ts
  • e2e/vue-start/server-routes/src/routes/api/params/$foo/route.ts
  • e2e/vue-start/server-routes/src/components/NotFound.tsx
  • e2e/vue-start/server-routes/tests/server-routes.spec.ts
  • e2e/vue-start/server-routes/src/routes/api/only-any.ts
  • e2e/vue-start/server-routes/src/routeTree.gen.ts
  • e2e/vue-start/server-routes/src/routes/index.tsx
  • e2e/vue-start/server-routes/src/routes/api/middleware-context.ts
**/*.{js,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Implement ESLint rules for router best practices using the ESLint plugin router

Files:

  • e2e/vue-start/server-routes/src/vite-env.d.ts
  • packages/vue-router/src/link.tsx
  • packages/vue-router/src/index.tsx
  • e2e/vue-start/server-routes/src/components/DefaultCatchBoundary.tsx
  • e2e/vue-start/server-routes/vite.config.ts
  • e2e/vue-start/server-routes/src/routes/methods/index.tsx
  • e2e/vue-start/server-routes/src/routes/methods/route.tsx
  • e2e/vue-start/server-routes/playwright.config.ts
  • e2e/vue-start/server-routes/src/routes/api/params/$foo/$bar.ts
  • e2e/vue-start/server-routes/src/router.tsx
  • e2e/vue-start/server-routes/src/routes/merge-middleware-context.tsx
  • e2e/vue-start/server-routes/src/routes/methods/only-any.tsx
  • e2e/vue-start/server-routes/src/routes/__root.tsx
  • packages/vue-router/src/route.ts
  • e2e/vue-start/server-routes/src/routes/api/params/$foo/route.ts
  • e2e/vue-start/server-routes/src/components/NotFound.tsx
  • e2e/vue-start/server-routes/tests/server-routes.spec.ts
  • e2e/vue-start/server-routes/src/routes/api/only-any.ts
  • e2e/vue-start/server-routes/src/routeTree.gen.ts
  • e2e/vue-start/server-routes/src/routes/index.tsx
  • e2e/vue-start/server-routes/src/routes/api/middleware-context.ts
**/package.json

📄 CodeRabbit inference engine (AGENTS.md)

Use workspace protocol workspace:* for internal dependencies in package.json files

Files:

  • e2e/vue-start/server-routes/package.json
🧠 Learnings (9)
📚 Learning: 2025-10-01T18:31:35.420Z
Learnt from: schiller-manuel
Repo: TanStack/router PR: 5330
File: e2e/react-start/custom-basepath/src/routeTree.gen.ts:58-61
Timestamp: 2025-10-01T18:31:35.420Z
Learning: Do not review files named `routeTree.gen.ts` in TanStack Router repositories, as these are autogenerated files that should not be manually modified.

Applied to files:

  • e2e/vue-start/server-routes/.prettierignore
  • e2e/vue-start/server-routes/.gitignore
  • e2e/vue-start/server-routes/src/routes/methods/route.tsx
  • e2e/vue-start/server-routes/src/routes/__root.tsx
  • e2e/vue-start/server-routes/src/routes/api/params/$foo/route.ts
  • e2e/vue-start/server-routes/tsconfig.json
  • e2e/vue-start/server-routes/src/routeTree.gen.ts
📚 Learning: 2025-10-08T08:11:47.088Z
Learnt from: nlynzaad
Repo: TanStack/router PR: 5402
File: packages/router-generator/tests/generator/no-formatted-route-tree/routeTree.nonnested.snapshot.ts:19-21
Timestamp: 2025-10-08T08:11:47.088Z
Learning: Test snapshot files in the router-generator tests directory (e.g., files matching the pattern `packages/router-generator/tests/generator/**/routeTree*.snapshot.ts` or `routeTree*.snapshot.js`) should not be modified or have issues flagged, as they are fixtures used to verify the generator's output and are intentionally preserved as-is.

Applied to files:

  • e2e/vue-start/server-routes/.prettierignore
  • e2e/vue-start/server-routes/.gitignore
  • e2e/vue-start/server-routes/src/routes/methods/index.tsx
  • e2e/vue-start/server-routes/src/routes/methods/route.tsx
  • e2e/vue-start/server-routes/src/routes/methods/only-any.tsx
  • e2e/vue-start/server-routes/src/routes/api/params/$foo/route.ts
  • e2e/vue-start/server-routes/tests/server-routes.spec.ts
  • e2e/vue-start/server-routes/src/routes/api/only-any.ts
  • e2e/vue-start/server-routes/tsconfig.json
  • e2e/vue-start/server-routes/src/routeTree.gen.ts
  • e2e/vue-start/server-routes/src/routes/index.tsx
  • e2e/vue-start/server-routes/src/routes/api/middleware-context.ts
📚 Learning: 2025-12-06T15:03:07.223Z
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-06T15:03:07.223Z
Learning: Applies to **/*.{js,ts,tsx} : Implement ESLint rules for router best practices using the ESLint plugin router

Applied to files:

  • e2e/vue-start/server-routes/.prettierignore
  • e2e/vue-start/server-routes/src/routes/methods/index.tsx
  • e2e/vue-start/server-routes/src/routes/methods/only-any.tsx
  • e2e/vue-start/server-routes/src/routes/__root.tsx
  • e2e/vue-start/server-routes/tests/server-routes.spec.ts
  • e2e/vue-start/server-routes/tsconfig.json
  • e2e/vue-start/server-routes/src/routeTree.gen.ts
  • e2e/vue-start/server-routes/src/routes/index.tsx
📚 Learning: 2025-11-02T16:16:24.898Z
Learnt from: nlynzaad
Repo: TanStack/router PR: 5732
File: packages/start-client-core/src/client/hydrateStart.ts:6-9
Timestamp: 2025-11-02T16:16:24.898Z
Learning: In packages/start-client-core/src/client/hydrateStart.ts, the `import/no-duplicates` ESLint disable is necessary for imports from `#tanstack-router-entry` and `#tanstack-start-entry` because both aliases resolve to the same placeholder file (`fake-start-entry.js`) in package.json during static analysis, even though they resolve to different files at runtime.

Applied to files:

  • e2e/vue-start/server-routes/.prettierignore
  • e2e/vue-start/server-routes/package.json
  • e2e/vue-start/server-routes/tsconfig.json
  • e2e/vue-start/server-routes/src/routeTree.gen.ts
📚 Learning: 2025-12-06T15:03:07.223Z
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-06T15:03:07.223Z
Learning: Use file-based routing in `src/routes/` directories or code-based routing with route definitions

Applied to files:

  • e2e/vue-start/server-routes/src/routes/methods/index.tsx
  • e2e/vue-start/server-routes/src/routes/methods/route.tsx
  • e2e/vue-start/server-routes/src/routeTree.gen.ts
  • e2e/vue-start/server-routes/src/routes/index.tsx
📚 Learning: 2025-12-17T02:17:47.423Z
Learnt from: schiller-manuel
Repo: TanStack/router PR: 6120
File: packages/router-generator/src/generator.ts:654-657
Timestamp: 2025-12-17T02:17:47.423Z
Learning: In `packages/router-generator/src/generator.ts`, pathless_layout routes must receive a `path` property when they have a `cleanedPath`, even though they are non-path routes. This is necessary because child routes inherit the path from their parent, and without this property, child routes would not have the correct full path at runtime.

Applied to files:

  • e2e/vue-start/server-routes/src/routes/methods/route.tsx
  • e2e/vue-start/server-routes/src/routes/__root.tsx
  • e2e/vue-start/server-routes/src/routeTree.gen.ts
  • e2e/vue-start/server-routes/src/routes/index.tsx
  • e2e/vue-start/server-routes/src/routes/api/middleware-context.ts
📚 Learning: 2025-10-14T18:59:33.990Z
Learnt from: FatahChan
Repo: TanStack/router PR: 5475
File: e2e/react-start/basic-prerendering/src/routes/redirect/$target/via-beforeLoad.tsx:8-0
Timestamp: 2025-10-14T18:59:33.990Z
Learning: In TanStack Router e2e test files, when a route parameter is validated at the route level (e.g., using zod in validateSearch or param validation), switch statements on that parameter do not require a default case, as the validation ensures only expected values will reach the switch.

Applied to files:

  • e2e/vue-start/server-routes/src/routes/methods/only-any.tsx
📚 Learning: 2025-10-09T12:59:02.129Z
Learnt from: hokkyss
Repo: TanStack/router PR: 5418
File: e2e/react-start/custom-identifier-prefix/src/styles/app.css:19-21
Timestamp: 2025-10-09T12:59:02.129Z
Learning: In e2e test directories (paths containing `e2e/`), accessibility concerns like outline suppression patterns are less critical since the code is for testing purposes, not production use.

Applied to files:

  • e2e/vue-start/server-routes/tests/server-routes.spec.ts
📚 Learning: 2025-12-06T15:03:07.223Z
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-06T15:03:07.223Z
Learning: Applies to **/*.{ts,tsx} : Use TypeScript strict mode with extensive type safety for all code

Applied to files:

  • e2e/vue-start/server-routes/tsconfig.json
🧬 Code graph analysis (12)
e2e/vue-start/server-routes/src/components/DefaultCatchBoundary.tsx (1)
packages/vue-router/src/index.tsx (6)
  • ErrorComponentProps (59-59)
  • useRouter (300-300)
  • useMatch (241-241)
  • rootRouteId (12-12)
  • ErrorComponent (128-128)
  • Link (143-143)
e2e/vue-start/server-routes/src/routes/methods/index.tsx (3)
e2e/vue-start/server-routes/src/routes/methods/only-any.tsx (1)
  • Route (5-8)
e2e/vue-start/server-routes/src/routes/index.tsx (1)
  • Route (3-5)
e2e/vue-start/server-routes/src/routes/methods/route.tsx (1)
  • Route (3-5)
e2e/vue-start/server-routes/src/routes/methods/route.tsx (2)
e2e/vue-start/server-routes/src/routes/methods/only-any.tsx (1)
  • Route (5-8)
e2e/vue-start/server-routes/src/routes/methods/index.tsx (1)
  • Route (3-5)
e2e/vue-start/server-routes/playwright.config.ts (1)
scripts/set-ts-version.js (1)
  • packageJson (33-33)
e2e/vue-start/server-routes/src/routes/api/params/$foo/$bar.ts (2)
e2e/vue-start/server-routes/src/routes/api/params/$foo/route.ts (1)
  • Route (3-11)
e2e/vue-start/server-routes/src/routes/index.tsx (1)
  • Route (3-5)
e2e/vue-start/server-routes/src/router.tsx (2)
e2e/vue-start/server-routes/src/components/DefaultCatchBoundary.tsx (1)
  • DefaultCatchBoundary (10-53)
e2e/vue-start/server-routes/src/components/NotFound.tsx (1)
  • NotFound (3-25)
e2e/vue-start/server-routes/src/routes/methods/only-any.tsx (3)
e2e/vue-start/server-routes/src/routes/api/only-any.ts (1)
  • Route (4-18)
e2e/vue-start/server-routes/src/routes/methods/index.tsx (1)
  • Route (3-5)
e2e/vue-start/server-routes/src/routes/methods/route.tsx (1)
  • Route (3-5)
e2e/vue-start/server-routes/src/routes/__root.tsx (2)
e2e/vue-start/server-routes/src/components/NotFound.tsx (1)
  • NotFound (3-25)
e2e/vue-start/query-integration/src/routes/__root.tsx (1)
  • RootComponent (30-81)
packages/vue-router/src/route.ts (2)
packages/vue-router/src/index.tsx (3)
  • LinkComponentRoute (222-222)
  • useRouter (300-300)
  • Link (143-143)
packages/router-core/src/route.ts (1)
  • fullPath (1557-1559)
e2e/vue-start/server-routes/src/components/NotFound.tsx (2)
e2e/solid-start/server-routes/src/components/NotFound.tsx (1)
  • NotFound (3-25)
e2e/react-start/server-routes/src/components/NotFound.tsx (1)
  • NotFound (3-25)
e2e/vue-start/server-routes/src/routes/api/only-any.ts (9)
e2e/vue-start/server-routes/src/routes/merge-middleware-context.tsx (1)
  • Route (73-75)
e2e/vue-start/server-routes/src/routes/__root.tsx (1)
  • Route (14-32)
e2e/vue-start/server-routes/src/routes/methods/only-any.tsx (1)
  • Route (5-8)
e2e/vue-start/server-routes/src/routes/api/middleware-context.ts (1)
  • Route (16-29)
e2e/vue-start/server-routes/src/routes/api/params/$foo/$bar.ts (1)
  • Route (3-11)
e2e/vue-start/server-routes/src/routes/api/params/$foo/route.ts (1)
  • Route (3-11)
e2e/vue-start/server-routes/src/routes/index.tsx (1)
  • Route (3-5)
e2e/vue-start/server-routes/src/routes/methods/index.tsx (1)
  • Route (3-5)
e2e/vue-start/server-routes/src/routes/methods/route.tsx (1)
  • Route (3-5)
e2e/vue-start/server-routes/src/routeTree.gen.ts (1)
e2e/vue-start/server-routes/src/router.tsx (1)
  • getRouter (8-20)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Test
🔇 Additional comments (24)
e2e/vue-start/server-routes/tsconfig.json (2)

3-22: LGTM! Solid TypeScript configuration for Vue e2e tests.

The compiler options are well-configured with strict mode, modern module resolution (Bundler), Vue JSX support, and appropriate ES2022 target settings. The path alias and noEmit settings are also appropriate for a Vite-bundled Vue project.


2-2: Remove the non-existent public/script*.js pattern from the include array.

The include pattern in tsconfig.json contains "public/script*.js", but no such files exist in the public directory. This is unnecessary configuration that should be removed: change ["**/*.ts", "**/*.tsx", "public/script*.js"] to ["**/*.ts", "**/*.tsx"].

⛔ Skipped due to learnings
Learnt from: schiller-manuel
Repo: TanStack/router PR: 5330
File: e2e/react-start/custom-basepath/src/routeTree.gen.ts:58-61
Timestamp: 2025-10-01T18:31:35.420Z
Learning: Do not review files named `routeTree.gen.ts` in TanStack Router repositories, as these are autogenerated files that should not be manually modified.
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-06T15:03:07.223Z
Learning: Applies to **/*.{ts,tsx} : Use TypeScript strict mode with extensive type safety for all code
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-06T15:03:07.223Z
Learning: Applies to **/*.{js,ts,tsx} : Implement ESLint rules for router best practices using the ESLint plugin router
e2e/vue-start/server-routes/src/routes/api/middleware-context.ts (1)

4-14: Middleware context merging behavior is correct and as expected.

The middleware chain properly merges context properties across parent and child middleware. When testParentMiddleware passes { testParent: true } and testMiddleware passes { test: true }, both properties are merged into the final context, as confirmed by the test assertion expectedContext: { testParent: true, test: true } at line 24. This pattern is consistent across all implementation variants (React, Solid, Vue) and follows TanStack Start's designed behavior where properties passed to context are merged.

e2e/vue-start/server-routes/src/routes/index.tsx (1)

1-23: LGTM! Route implementation follows TanStack Router conventions.

The root route is correctly defined with file-based routing, and the Home component provides clear navigation to server route test pages.

e2e/vue-start/server-routes/src/styles/app.css (1)

1-30: LGTM! Tailwind configuration is well-structured.

The CSS properly configures Tailwind with dark mode support and appropriate base styles. The outline suppression for mouse users (line 28) is correctly scoped to the .using-mouse class.

e2e/vue-start/server-routes/vite.config.ts (1)

1-19: LGTM! Vite configuration is correct.

The plugin order and configuration are appropriate for a Vue + TanStack Start project with JSX support.

e2e/vue-start/server-routes/src/router.tsx (1)

8-20: LGTM! Router setup is correct.

The router configuration properly integrates QueryClient with SSR support and sets up appropriate defaults for error handling and not-found scenarios.

e2e/vue-start/server-routes/src/components/NotFound.tsx (1)

1-25: LGTM! NotFound component is correctly implemented.

The component properly uses Vue's class attribute and provides appropriate fallback UI with navigation options.

e2e/vue-start/server-routes/src/routes/api/params/$foo/route.ts (1)

1-11: LGTM! Server route handler is appropriate for E2E testing.

The GET handler correctly demonstrates dynamic parameter routing. The simple implementation is suitable for testing purposes.

e2e/vue-start/server-routes/src/routes/methods/index.tsx (1)

12-14: Good use of typed Route.Link for type safety.

Using Route.Link provides route-specific type safety. Note that other files in this PR use the imported Link component directly, creating a minor inconsistency in link usage patterns across the codebase.

e2e/vue-start/server-routes/src/routes/api/params/$foo/$bar.ts (1)

1-11: LGTM! Nested parameter route is correctly implemented.

The GET handler properly demonstrates two-level dynamic parameter routing, consistent with the single-parameter route pattern.

e2e/vue-start/server-routes/src/routes/merge-middleware-context.tsx (1)

1-75: Well-structured e2e test component.

The component correctly implements the middleware context testing functionality with proper error handling and data-testid attributes for Playwright tests.

e2e/vue-start/server-routes/playwright.config.ts (1)

1-35: LGTM!

The Playwright configuration follows the established patterns in the repository. The top-level await for port assignment, web server configuration with build command, and CI-aware server reuse are all correctly implemented.

e2e/vue-start/server-routes/tests/server-routes.spec.ts (2)

4-18: LGTM!

The middleware context test correctly navigates, triggers the action, and validates both the presence of context values and their content. The use of networkidle for synchronization is appropriate for this fetch-based interaction.


20-46: LGTM!

The dynamic test case discovery pattern is well-implemented. It collects all expected elements, validates each has a corresponding result, and provides clear error messages when test IDs are missing.

e2e/vue-start/server-routes/src/routes/api/only-any.ts (1)

1-18: LGTM!

The API route correctly implements an ANY handler that responds to all HTTP methods. The response includes both JSON body and custom headers (X-HANDLER, X-METHOD), which aligns with the client-side test in methods/only-any.tsx that falls back to headers for HEAD/OPTIONS requests.

e2e/vue-start/server-routes/src/routes/__root.tsx (1)

1-47: LGTM!

The root route configuration is well-structured with proper head management (charset, viewport, stylesheet), error/not-found components, and a clean document structure. The pattern aligns with similar setups in other Vue e2e test projects.

e2e/vue-start/server-routes/src/routes/methods/only-any.tsx (1)

26-69: Well-implemented test component.

The Test component correctly handles all HTTP methods, including the edge case where HEAD/OPTIONS responses have no body. The fallback to reading x-handler and x-method headers aligns with the server implementation in api/only-any.ts.

e2e/vue-start/server-routes/src/routeTree.gen.ts (1)

1-257: Skipping review of auto-generated file.

This file is auto-generated by TanStack Router and should not be manually modified. Based on learnings, no review comments are generated for routeTree.gen.ts files.

packages/vue-router/src/index.tsx (1)

222-222: LGTM!

Clean type export addition that properly exposes the new LinkComponentRoute interface to the public API.

packages/vue-router/src/route.ts (3)

7-7: LGTM!

Runtime import of Link component is necessary for the new Link property implementations.


46-48: LGTM!

Importing Vue as a runtime dependency (rather than type-only) is required for using Vue.h() in the Link implementations, and adding the LinkComponentRoute type import is appropriate.


78-78: LGTM!

Adding the Link property to RouteExtensions properly extends the route API surface with the typed link component.

packages/vue-router/src/link.tsx (1)

633-651: The defaultFrom property is type-only and the implementations are correct.

The LinkComponentRoute interface declares defaultFrom as a type-level property with in out variance to capture the generic parameter for TypeScript inference. Inside the callable signature, it accesses this via this['defaultFrom'] purely at the type level. The implementations in route.ts correctly cast functions to LinkComponentRoute<...> without assigning a runtime .defaultFrom property because none is needed—this is the intended design pattern for type-safe generic routing.

Likely an incorrect or invalid review comment.

Comment on lines +16 to +19
"@tanstack/vue-router": "workspace:^",
"@tanstack/vue-router-devtools": "workspace:^",
"@tanstack/vue-router-ssr-query": "workspace:^",
"@tanstack/vue-start": "workspace:^",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Use workspace:* protocol for internal dependencies.

Internal TanStack packages currently use workspace:^ but the coding guidelines specify using workspace:* for workspace dependencies. This ensures exact version matching across the monorepo.

Apply this diff to align with project conventions:

   "dependencies": {
     "@tanstack/vue-query": "^5.90.9",
-    "@tanstack/vue-router": "workspace:^",
-    "@tanstack/vue-router-devtools": "workspace:^",
-    "@tanstack/vue-router-ssr-query": "workspace:^",
-    "@tanstack/vue-start": "workspace:^",
+    "@tanstack/vue-router": "workspace:*",
+    "@tanstack/vue-router-devtools": "workspace:*",
+    "@tanstack/vue-router-ssr-query": "workspace:*",
+    "@tanstack/vue-start": "workspace:*",
     "js-cookie": "^3.0.5",
     "redaxios": "^0.5.1",
   "devDependencies": {
     "@playwright/test": "^1.50.1",
     "@tailwindcss/postcss": "^4.1.15",
-    "@tanstack/router-e2e-utils": "workspace:^",
+    "@tanstack/router-e2e-utils": "workspace:*",
     "@types/js-cookie": "^3.0.6",

As per coding guidelines for workspace dependencies.

Also applies to: 30-30

🤖 Prompt for AI Agents
In e2e/vue-start/server-routes/package.json around lines 16 to 19 (and also line
30), the internal TanStack dependencies use the "workspace:^" protocol; change
them to use "workspace:*" to follow project conventions. Edit each workspace
dependency entry (e.g., "@tanstack/vue-router", "@tanstack/vue-router-devtools",
"@tanstack/vue-router-ssr-query", "@tanstack/vue-start") and replace the version
specifier "workspace:^" with "workspace:*" so internal packages resolve to the
exact workspace versions.

Comment on lines +39 to +48
<Link
to="/"
class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}
onClick={(e: MouseEvent) => {
e.preventDefault()
window.history.back()
}}
>
Go Back
</Link>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Misleading to prop on "Go Back" link.

The Go Back link specifies to="/" but prevents default navigation and calls window.history.back() instead. The to prop is misleading since the link doesn't actually navigate to the root route.

Consider refactoring to use a button element instead:

-        <Link
-          to="/"
-          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}
-          onClick={(e: MouseEvent) => {
-            e.preventDefault()
-            window.history.back()
-          }}
-        >
-          Go Back
-        </Link>
+        <button
+          onClick={() => {
+            window.history.back()
+          }}
+          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}
+        >
+          Go Back
+        </button>

This makes the intent clearer and avoids the misleading to prop.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Link
to="/"
class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}
onClick={(e: MouseEvent) => {
e.preventDefault()
window.history.back()
}}
>
Go Back
</Link>
<button
onClick={() => {
window.history.back()
}}
class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}
>
Go Back
</button>
🤖 Prompt for AI Agents
In e2e/vue-start/server-routes/src/components/DefaultCatchBoundary.tsx around
lines 39 to 48, the Link uses a misleading to="/" prop while preventing default
and calling window.history.back(); replace the Link with a semantic <button>
element (type="button") using the same className/styles and keep the onClick
handler that calls window.history.back() so no navigation prop is present and
intent is clear; remove the to prop and any Link-specific imports if no longer
used.

Comment on lines +147 to +158
Link: LinkComponentRoute<RouteTypesById<TRouter, TId>['fullPath']> = ((
props,
ctx?: Vue.SetupContext,
) => {
const router = useRouter()
const fullPath = router.routesById[this.id as string].fullPath
return Vue.h(
Link as any,
{ from: fullPath as never, ...(props as any) },
ctx?.slots,
)
}) as LinkComponentRoute<RouteTypesById<TRouter, TId>['fullPath']>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# First, let's check if the file exists and examine its structure
find . -path "*/packages/vue-router/src/route.ts" -type f 2>/dev/null | head -5

Repository: TanStack/router

Length of output: 93


🏁 Script executed:

#!/bin/bash
# Also list the packages directory to understand the structure
ls -la packages/ 2>/dev/null | head -20

Repository: TanStack/router

Length of output: 1294


🏁 Script executed:

#!/bin/bash
# Check file size and read the file
wc -l ./packages/vue-router/src/route.ts

Repository: TanStack/router

Length of output: 97


🏁 Script executed:

#!/bin/bash
# Read the file with context around lines 147-158
cat -n ./packages/vue-router/src/route.ts | sed -n '130,165p'

Repository: TanStack/router

Length of output: 1438


🏁 Script executed:

#!/bin/bash
# Check the tsconfig.json for TypeScript strict mode
find . -name "tsconfig.json" -type f | head -5 | xargs -I {} sh -c 'echo "=== {} ===" && cat {}'

Repository: TanStack/router

Length of output: 1744


🏁 Script executed:

#!/bin/bash
# Read the beginning of the file to see imports and understand the context
cat -n ./packages/vue-router/src/route.ts | head -50

Repository: TanStack/router

Length of output: 1757


🏁 Script executed:

#!/bin/bash
# Look for LinkComponentRoute type definition and related types
cat -n ./packages/vue-router/src/route.ts | grep -A 5 "LinkComponentRoute\|useRouter\|Link:"

Repository: TanStack/router

Length of output: 2397


🏁 Script executed:

#!/bin/bash
# Check the class context around the Link property
cat -n ./packages/vue-router/src/route.ts | sed -n '100,160p'

Repository: TanStack/router

Length of output: 2112


🏁 Script executed:

#!/bin/bash
# Check the root tsconfig.json
cat ./tsconfig.json

Repository: TanStack/router

Length of output: 846


🏁 Script executed:

#!/bin/bash
# Look at the link.ts file to understand LinkComponentRoute type
head -100 ./packages/vue-router/src/link.ts

Repository: TanStack/router

Length of output: 151


🏁 Script executed:

#!/bin/bash
# Search for how LinkComponentRoute is defined
grep -n "LinkComponentRoute\|export type\|interface" ./packages/vue-router/src/link.ts | head -30

Repository: TanStack/router

Length of output: 125


🏁 Script executed:

#!/bin/bash
# Search for link files in packages/vue-router
find ./packages/vue-router -name "*link*" -type f

Repository: TanStack/router

Length of output: 222


🏁 Script executed:

#!/bin/bash
# Search for LinkComponentRoute definition across the codebase
rg "LinkComponentRoute" --type ts -B 3 -A 3 | head -100

Repository: TanStack/router

Length of output: 5763


🏁 Script executed:

#!/bin/bash
# List all files in packages/vue-router/src
ls -la ./packages/vue-router/src/

Repository: TanStack/router

Length of output: 2890


🏁 Script executed:

#!/bin/bash
# Read the link.tsx file to understand LinkComponentRoute interface
head -150 ./packages/vue-router/src/link.tsx

Repository: TanStack/router

Length of output: 4343


🏁 Script executed:

#!/bin/bash
# Look at the LinkComponentRoute interface definition
rg "export interface LinkComponentRoute" -A 20 ./packages/vue-router/src/link.tsx

Repository: TanStack/router

Length of output: 528


🏁 Script executed:

#!/bin/bash
# Check how the Link component is implemented
grep -n "^export.*Link\|^function\|^const.*Link" ./packages/vue-router/src/link.tsx | head -20

Repository: TanStack/router

Length of output: 776


🏁 Script executed:

#!/bin/bash
# Look at the full LinkComponentRoute interface and surrounding code
cat -n ./packages/vue-router/src/link.tsx | sed -n '633,700p'

Repository: TanStack/router

Length of output: 2139


🏁 Script executed:

#!/bin/bash
# Check how Link is defined and exported
cat -n ./packages/vue-router/src/link.tsx | sed -n '746,760p'

Repository: TanStack/router

Length of output: 683


🏁 Script executed:

#!/bin/bash
# Look for any comments or context explaining why these casts are used
cat -n ./packages/vue-router/src/route.ts | sed -n '140,165p'

Repository: TanStack/router

Length of output: 1104


🏁 Script executed:

#!/bin/bash
# Check if similar patterns exist in react-router or solid-router for comparison
rg "Link as any.*as never" --type ts --type tsx -B 2 -A 2 | head -50

Repository: TanStack/router

Length of output: 86


🏁 Script executed:

#!/bin/bash
# Look for any TODOs or FIXMEs related to Link or type assertions
rg "TODO|FIXME|XXX" ./packages/vue-router/src/route.ts -B 2 -A 2

Repository: TanStack/router

Length of output: 41


🏁 Script executed:

#!/bin/bash
# Check the useRouter implementation to understand its signature
cat ./packages/vue-router/src/useRouter.tsx

Repository: TanStack/router

Length of output: 562


🏁 Script executed:

#!/bin/bash
# Search for similar patterns in other framework implementations to understand if this is intentional
rg "Link as any" --type ts -B 3 -A 3 packages/

Repository: TanStack/router

Length of output: 1362


🏁 Script executed:

#!/bin/bash
# Check git history for this file to see if there are comments about these type assertions
git log --oneline -n 20 packages/vue-router/src/route.ts

Repository: TanStack/router

Length of output: 94


🏁 Script executed:

#!/bin/bash
# Look at the RouteApi class structure to understand the full context
cat -n ./packages/vue-router/src/route.ts | sed -n '85,110p'

Repository: TanStack/router

Length of output: 921


Remove excessive type assertions to comply with TypeScript strict mode.

The implementation uses multiple type assertions (as any, as never, and the final cast) that circumvent TypeScript's type checking. This violates the coding guideline requiring "TypeScript strict mode with extensive type safety for all code."

The assertions suggest the LinkComponentRoute interface signature doesn't properly align with what can be implemented as a simple function component. Consider:

  1. Properly typing the props spreading to avoid ...(props as any)
  2. Fixing the from type assertion instead of using as never
  3. Ensuring the Link component type matches without needing as any
  4. Reviewing the LinkComponentRoute interface design to better accommodate Vue function components

Comment on lines +297 to +303
Link: LinkComponentRoute<TFullPath> = ((props, ctx?: Vue.SetupContext) => {
return Vue.h(
Link as any,
{ from: this.fullPath as never, ...(props as any) },
ctx?.slots,
)
}) as LinkComponentRoute<TFullPath>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Remove excessive type assertions to comply with TypeScript strict mode.

Similar to the RouteApi.Link implementation, this code uses multiple type assertions that suppress TypeScript's type checking:

  • Link as any
  • from: this.fullPath as never
  • ...(props as any)
  • Final cast to LinkComponentRoute<TFullPath>

This violates the coding guideline requiring strict TypeScript with extensive type safety.

As per coding guidelines, TypeScript files should use strict mode with extensive type safety. Please properly type these expressions instead of using assertions.

🤖 Prompt for AI Agents
In packages/vue-router/src/route.ts around lines 297 to 303, the inline
component factory uses multiple unsafe casts (Link as any, this.fullPath as
never, props as any, and the final cast to LinkComponentRoute<TFullPath>);
replace these casts by typing the factory and its parameters correctly:
import/declare the Link component's proper Vue component type and its prop type,
type the factory's props parameter as that prop type (or a subset mapped to
Link's props), type ctx as Vue.SetupContext properly, and call Vue.h with the
typed component and a typed props object that includes from: this.fullPath (use
the correct prop type for from so no never cast is needed); finally set the
function's return type to LinkComponentRoute<TFullPath> without asserting.
Ensure all intermediate values conform to those declared types so no as
any/never casts are required.

Comment on lines +543 to +549
Link: LinkComponentRoute<'/'> = ((props, ctx?: Vue.SetupContext) => {
return Vue.h(
Link as any,
{ from: this.fullPath as never, ...(props as any) },
ctx?.slots,
)
}) as LinkComponentRoute<'/'>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Remove excessive type assertions to comply with TypeScript strict mode.

This implementation follows the same problematic pattern as the other Link implementations, using multiple type assertions that bypass TypeScript's type checking.

As per coding guidelines, TypeScript files should use strict mode with extensive type safety. Consider refactoring to properly type the Link component integration without relying on assertions.

🤖 Prompt for AI Agents
packages/vue-router/src/route.ts lines 543-549: the inline Link factory uses
multiple "as any"/"as never" assertions which defeat strict-mode type checking;
remove those assertions and properly type the function parameters and the props
object so you can pass a correctly-typed props object to Vue.h without casts.
Concretely, change the params to accept the correct Link props type and
Vue.SetupContext type, build a new props object that sets from: this.fullPath
(typed as the expected string/location type) merged with the incoming props
using the proper props type, and call Vue.h(Link, propsObject, ctx?.slots)
returning a Vue.VNode; ensure the function signature remains
LinkComponentRoute<'/'> but uses explicit, correct types instead of any/never.

@birkskyum birkskyum merged commit d5a7aee into main Dec 17, 2025
7 of 8 checks passed
@birkskyum birkskyum deleted the server-routes-vue branch December 17, 2025 19:16
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.

2 participants