From 1c67edbd2a74284bb8121cb87b7ef5df39b0b375 Mon Sep 17 00:00:00 2001 From: swarnim02 Date: Sun, 23 Nov 2025 23:36:12 +0530 Subject: [PATCH 1/7] fix: resolve validation types circular reference in loaders Fixes TypeScript error when using validation types in createFileRoute loaders. Replaced Constrain with conditional types to prevent circular references. - Fix ValidateLinkOptions, ValidateNavigateOptions, ValidateRedirectOptions - Add comprehensive regression tests - Maintain backward compatibility --- packages/react-router/src/typePrimitives.ts | 78 ++++++---- .../tests/validateLinkOptions.test.tsx | 139 ++++++++++++++++++ packages/router-core/src/typePrimitives.ts | 66 +++++---- 3 files changed, 227 insertions(+), 56 deletions(-) create mode 100644 packages/react-router/tests/validateLinkOptions.test.tsx diff --git a/packages/react-router/src/typePrimitives.ts b/packages/react-router/src/typePrimitives.ts index 317ab260c86..263dcff8473 100644 --- a/packages/react-router/src/typePrimitives.ts +++ b/packages/react-router/src/typePrimitives.ts @@ -19,17 +19,23 @@ export type ValidateLinkOptions< TOptions = unknown, TDefaultFrom extends string = string, TComp = 'a', -> = Constrain< - TOptions, - LinkComponentProps< - TComp, - TRouter, - InferFrom, - InferTo, - InferMaskFrom, - InferMaskTo - > +> = TOptions extends LinkComponentProps< + TComp, + TRouter, + InferFrom, + InferTo, + InferMaskFrom, + InferMaskTo > + ? TOptions + : LinkComponentProps< + TComp, + TRouter, + InferFrom, + InferTo, + InferMaskFrom, + InferMaskTo + > /** * @private @@ -43,32 +49,44 @@ export type InferStructuralSharing = TOptions extends { export type ValidateUseSearchOptions< TOptions, TRouter extends AnyRouter = RegisteredRouter, -> = Constrain< - TOptions, - UseSearchOptions< - TRouter, - InferFrom, - InferStrict, - InferShouldThrow, - InferSelected, - InferStructuralSharing - > +> = TOptions extends UseSearchOptions< + TRouter, + InferFrom, + InferStrict, + InferShouldThrow, + InferSelected, + InferStructuralSharing > + ? TOptions + : UseSearchOptions< + TRouter, + InferFrom, + InferStrict, + InferShouldThrow, + InferSelected, + InferStructuralSharing + > export type ValidateUseParamsOptions< TOptions, TRouter extends AnyRouter = RegisteredRouter, -> = Constrain< - TOptions, - UseParamsOptions< - TRouter, - InferFrom, - InferStrict, - InferShouldThrow, - InferSelected, - InferSelected - > +> = TOptions extends UseParamsOptions< + TRouter, + InferFrom, + InferStrict, + InferShouldThrow, + InferSelected, + InferSelected > + ? TOptions + : UseParamsOptions< + TRouter, + InferFrom, + InferStrict, + InferShouldThrow, + InferSelected, + InferSelected + > export type ValidateLinkOptionsArray< TRouter extends AnyRouter = RegisteredRouter, TOptions extends ReadonlyArray = ReadonlyArray, diff --git a/packages/react-router/tests/validateLinkOptions.test.tsx b/packages/react-router/tests/validateLinkOptions.test.tsx new file mode 100644 index 00000000000..066417376eb --- /dev/null +++ b/packages/react-router/tests/validateLinkOptions.test.tsx @@ -0,0 +1,139 @@ +import { describe, expect, test } from 'vitest' +import { createFileRoute } from '../src/fileRoute' +import type { + ValidateLinkOptions, + ValidateUseSearchOptions, + ValidateUseParamsOptions +} from '../src/typePrimitives' +import type { + ValidateNavigateOptions, + ValidateRedirectOptions +} from '@tanstack/router-core' + +describe('Validation types regression tests', () => { + test('should not cause TypeScript circular reference error in loader return type', () => { + // This test ensures that ValidateLinkOptions can be used in loader return types + // without causing the TypeScript error: + // 'loader' implicitly has return type 'any' because it does not have a return type annotation + + const route = createFileRoute('/user/$userId')({ + loader: (): { breadcrumbs: ValidateLinkOptions } => { + const breadcrumbs: ValidateLinkOptions = { + to: '/user/$userId', + params: { userId: '123' } + } + + return { + breadcrumbs + } + }, + component: () =>
User
+ }) + + expect(route).toBeDefined() + }) + + test('should work with ValidateLinkOptions directly in loader', () => { + const route = createFileRoute('/profile/$userId')({ + loader: () => { + const linkOptions: ValidateLinkOptions = { + to: '/profile/$userId', + params: { userId: '456' } + } + + return { + navigation: linkOptions + } + }, + component: () =>
Profile
+ }) + + expect(route).toBeDefined() + }) + + test('should work with array of ValidateLinkOptions', () => { + const route = createFileRoute('/dashboard')({ + loader: () => { + const breadcrumbs: ValidateLinkOptions[] = [ + { to: '/' }, + { to: '/dashboard' } + ] + + return { + breadcrumbs + } + }, + component: () =>
Dashboard
+ }) + + expect(route).toBeDefined() + }) + + test('should work with ValidateNavigateOptions in loader', () => { + const route = createFileRoute('/navigate-test')({ + loader: () => { + const navOptions: ValidateNavigateOptions = { + to: '/dashboard' + } + + return { + navOptions + } + }, + component: () =>
Navigate Test
+ }) + + expect(route).toBeDefined() + }) + + test('should work with ValidateRedirectOptions in loader', () => { + const route = createFileRoute('/redirect-test')({ + loader: () => { + const redirectOptions: ValidateRedirectOptions = { + to: '/login' + } + + return { + redirectOptions + } + }, + component: () =>
Redirect Test
+ }) + + expect(route).toBeDefined() + }) + + test('should work with ValidateUseSearchOptions in loader', () => { + const route = createFileRoute('/search-test')({ + loader: () => { + const searchOptions: ValidateUseSearchOptions<{ from: '/search-test' }> = { + from: '/search-test' + } + + return { + searchOptions + } + }, + component: () =>
Search Test
+ }) + + expect(route).toBeDefined() + }) + + test('should work with ValidateUseParamsOptions in loader', () => { + const route = createFileRoute('/params-test/$id')({ + loader: () => { + const paramsOptions: ValidateUseParamsOptions<{ from: '/params-test/$id' }> = { + from: '/params-test/$id' + } + + return { + paramsOptions + } + }, + component: () =>
Params Test
+ }) + + expect(route).toBeDefined() + }) +}) \ No newline at end of file diff --git a/packages/router-core/src/typePrimitives.ts b/packages/router-core/src/typePrimitives.ts index 5f7d4b8e2f0..f033468f19d 100644 --- a/packages/router-core/src/typePrimitives.ts +++ b/packages/router-core/src/typePrimitives.ts @@ -75,16 +75,21 @@ export type ValidateNavigateOptions< TRouter extends AnyRouter = RegisteredRouter, TOptions = unknown, TDefaultFrom extends string = string, -> = Constrain< - TOptions, - NavigateOptions< - TRouter, - InferFrom, - InferTo, - InferMaskFrom, - InferMaskTo - > +> = TOptions extends NavigateOptions< + TRouter, + InferFrom, + InferTo, + InferMaskFrom, + InferMaskTo > + ? TOptions + : NavigateOptions< + TRouter, + InferFrom, + InferTo, + InferMaskFrom, + InferMaskTo + > export type ValidateNavigateOptionsArray< TRouter extends AnyRouter = RegisteredRouter, @@ -102,16 +107,21 @@ export type ValidateRedirectOptions< TRouter extends AnyRouter = RegisteredRouter, TOptions = unknown, TDefaultFrom extends string = string, -> = Constrain< - TOptions, - RedirectOptions< - TRouter, - InferFrom, - InferTo, - InferMaskFrom, - InferMaskTo - > +> = TOptions extends RedirectOptions< + TRouter, + InferFrom, + InferTo, + InferMaskFrom, + InferMaskTo > + ? TOptions + : RedirectOptions< + TRouter, + InferFrom, + InferTo, + InferMaskFrom, + InferMaskTo + > export type ValidateRedirectOptionsArray< TRouter extends AnyRouter = RegisteredRouter, @@ -170,12 +180,16 @@ export type ValidateUseSearchResult< export type ValidateUseParamsResult< TOptions, TRouter extends AnyRouter = RegisteredRouter, -> = Constrain< - TOptions, - UseParamsResult< - TRouter, - InferFrom, - InferStrict, - InferSelected - > +> = TOptions extends UseParamsResult< + TRouter, + InferFrom, + InferStrict, + InferSelected > + ? TOptions + : UseParamsResult< + TRouter, + InferFrom, + InferStrict, + InferSelected + > From 6c98d0b7eb62186f8ed226fee750a644177690b2 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sun, 23 Nov 2025 18:34:31 +0000 Subject: [PATCH 2/7] ci: apply automated fixes --- .../worker-configuration.d.ts | 15 ++- packages/react-router/src/typePrimitives.ts | 105 +++++++++--------- .../tests/validateLinkOptions.test.tsx | 86 +++++++------- packages/router-core/src/typePrimitives.ts | 89 ++++++++------- 4 files changed, 154 insertions(+), 141 deletions(-) diff --git a/e2e/solid-start/basic-cloudflare/worker-configuration.d.ts b/e2e/solid-start/basic-cloudflare/worker-configuration.d.ts index b0b47f39468..cb3e271c882 100644 --- a/e2e/solid-start/basic-cloudflare/worker-configuration.d.ts +++ b/e2e/solid-start/basic-cloudflare/worker-configuration.d.ts @@ -2,16 +2,19 @@ // Generated by Wrangler by running `wrangler types` (hash: b11df627d8b3c51b1bf3230a546b0f20) // Runtime types generated with workerd@1.20251118.0 2025-09-24 nodejs_compat declare namespace Cloudflare { - interface Env { - MY_VAR: "Hello from Cloudflare"; - } + interface Env { + MY_VAR: 'Hello from Cloudflare' + } } interface Env extends Cloudflare.Env {} type StringifyValues> = { - [Binding in keyof EnvType]: EnvType[Binding] extends string ? EnvType[Binding] : string; -}; + [Binding in keyof EnvType]: EnvType[Binding] extends string + ? EnvType[Binding] + : string +} declare namespace NodeJS { - interface ProcessEnv extends StringifyValues> {} + interface ProcessEnv + extends StringifyValues> {} } // Begin runtime types diff --git a/packages/react-router/src/typePrimitives.ts b/packages/react-router/src/typePrimitives.ts index 263dcff8473..2f7cdc3b13e 100644 --- a/packages/react-router/src/typePrimitives.ts +++ b/packages/react-router/src/typePrimitives.ts @@ -19,23 +19,24 @@ export type ValidateLinkOptions< TOptions = unknown, TDefaultFrom extends string = string, TComp = 'a', -> = TOptions extends LinkComponentProps< - TComp, - TRouter, - InferFrom, - InferTo, - InferMaskFrom, - InferMaskTo -> - ? TOptions - : LinkComponentProps< - TComp, - TRouter, - InferFrom, - InferTo, - InferMaskFrom, - InferMaskTo - > +> = + TOptions extends LinkComponentProps< + TComp, + TRouter, + InferFrom, + InferTo, + InferMaskFrom, + InferMaskTo + > + ? TOptions + : LinkComponentProps< + TComp, + TRouter, + InferFrom, + InferTo, + InferMaskFrom, + InferMaskTo + > /** * @private @@ -49,44 +50,46 @@ export type InferStructuralSharing = TOptions extends { export type ValidateUseSearchOptions< TOptions, TRouter extends AnyRouter = RegisteredRouter, -> = TOptions extends UseSearchOptions< - TRouter, - InferFrom, - InferStrict, - InferShouldThrow, - InferSelected, - InferStructuralSharing -> - ? TOptions - : UseSearchOptions< - TRouter, - InferFrom, - InferStrict, - InferShouldThrow, - InferSelected, - InferStructuralSharing - > +> = + TOptions extends UseSearchOptions< + TRouter, + InferFrom, + InferStrict, + InferShouldThrow, + InferSelected, + InferStructuralSharing + > + ? TOptions + : UseSearchOptions< + TRouter, + InferFrom, + InferStrict, + InferShouldThrow, + InferSelected, + InferStructuralSharing + > export type ValidateUseParamsOptions< TOptions, TRouter extends AnyRouter = RegisteredRouter, -> = TOptions extends UseParamsOptions< - TRouter, - InferFrom, - InferStrict, - InferShouldThrow, - InferSelected, - InferSelected -> - ? TOptions - : UseParamsOptions< - TRouter, - InferFrom, - InferStrict, - InferShouldThrow, - InferSelected, - InferSelected - > +> = + TOptions extends UseParamsOptions< + TRouter, + InferFrom, + InferStrict, + InferShouldThrow, + InferSelected, + InferSelected + > + ? TOptions + : UseParamsOptions< + TRouter, + InferFrom, + InferStrict, + InferShouldThrow, + InferSelected, + InferSelected + > export type ValidateLinkOptionsArray< TRouter extends AnyRouter = RegisteredRouter, TOptions extends ReadonlyArray = ReadonlyArray, diff --git a/packages/react-router/tests/validateLinkOptions.test.tsx b/packages/react-router/tests/validateLinkOptions.test.tsx index 066417376eb..20b2e908fa2 100644 --- a/packages/react-router/tests/validateLinkOptions.test.tsx +++ b/packages/react-router/tests/validateLinkOptions.test.tsx @@ -1,13 +1,13 @@ import { describe, expect, test } from 'vitest' import { createFileRoute } from '../src/fileRoute' -import type { - ValidateLinkOptions, - ValidateUseSearchOptions, - ValidateUseParamsOptions +import type { + ValidateLinkOptions, + ValidateUseSearchOptions, + ValidateUseParamsOptions, } from '../src/typePrimitives' -import type { - ValidateNavigateOptions, - ValidateRedirectOptions +import type { + ValidateNavigateOptions, + ValidateRedirectOptions, } from '@tanstack/router-core' describe('Validation types regression tests', () => { @@ -15,19 +15,19 @@ describe('Validation types regression tests', () => { // This test ensures that ValidateLinkOptions can be used in loader return types // without causing the TypeScript error: // 'loader' implicitly has return type 'any' because it does not have a return type annotation - + const route = createFileRoute('/user/$userId')({ loader: (): { breadcrumbs: ValidateLinkOptions } => { const breadcrumbs: ValidateLinkOptions = { to: '/user/$userId', - params: { userId: '123' } + params: { userId: '123' }, } - + return { - breadcrumbs + breadcrumbs, } }, - component: () =>
User
+ component: () =>
User
, }) expect(route).toBeDefined() @@ -38,14 +38,14 @@ describe('Validation types regression tests', () => { loader: () => { const linkOptions: ValidateLinkOptions = { to: '/profile/$userId', - params: { userId: '456' } + params: { userId: '456' }, } - + return { - navigation: linkOptions + navigation: linkOptions, } }, - component: () =>
Profile
+ component: () =>
Profile
, }) expect(route).toBeDefined() @@ -56,84 +56,88 @@ describe('Validation types regression tests', () => { loader: () => { const breadcrumbs: ValidateLinkOptions[] = [ { to: '/' }, - { to: '/dashboard' } + { to: '/dashboard' }, ] - + return { - breadcrumbs + breadcrumbs, } }, - component: () =>
Dashboard
+ component: () =>
Dashboard
, }) expect(route).toBeDefined() }) test('should work with ValidateNavigateOptions in loader', () => { - const route = createFileRoute('/navigate-test')({ + const route = createFileRoute('/navigate-test')({ loader: () => { const navOptions: ValidateNavigateOptions = { - to: '/dashboard' + to: '/dashboard', } - + return { - navOptions + navOptions, } }, - component: () =>
Navigate Test
+ component: () =>
Navigate Test
, }) expect(route).toBeDefined() }) test('should work with ValidateRedirectOptions in loader', () => { - const route = createFileRoute('/redirect-test')({ + const route = createFileRoute('/redirect-test')({ loader: () => { const redirectOptions: ValidateRedirectOptions = { - to: '/login' + to: '/login', } - + return { - redirectOptions + redirectOptions, } }, - component: () =>
Redirect Test
+ component: () =>
Redirect Test
, }) expect(route).toBeDefined() }) test('should work with ValidateUseSearchOptions in loader', () => { - const route = createFileRoute('/search-test')({ + const route = createFileRoute('/search-test')({ loader: () => { - const searchOptions: ValidateUseSearchOptions<{ from: '/search-test' }> = { + const searchOptions: ValidateUseSearchOptions<{ from: '/search-test' + }> = { + from: '/search-test', } - + return { - searchOptions + searchOptions, } }, - component: () =>
Search Test
+ component: () =>
Search Test
, }) expect(route).toBeDefined() }) test('should work with ValidateUseParamsOptions in loader', () => { - const route = createFileRoute('/params-test/$id')({ + const route = createFileRoute('/params-test/$id')({ loader: () => { - const paramsOptions: ValidateUseParamsOptions<{ from: '/params-test/$id' }> = { + const paramsOptions: ValidateUseParamsOptions<{ from: '/params-test/$id' + }> = { + from: '/params-test/$id', } - + return { - paramsOptions + paramsOptions, } }, - component: () =>
Params Test
+ component: () =>
Params Test
, }) expect(route).toBeDefined() }) -}) \ No newline at end of file +}) diff --git a/packages/router-core/src/typePrimitives.ts b/packages/router-core/src/typePrimitives.ts index f033468f19d..3b6875e92f1 100644 --- a/packages/router-core/src/typePrimitives.ts +++ b/packages/router-core/src/typePrimitives.ts @@ -75,21 +75,22 @@ export type ValidateNavigateOptions< TRouter extends AnyRouter = RegisteredRouter, TOptions = unknown, TDefaultFrom extends string = string, -> = TOptions extends NavigateOptions< - TRouter, - InferFrom, - InferTo, - InferMaskFrom, - InferMaskTo -> - ? TOptions - : NavigateOptions< - TRouter, - InferFrom, - InferTo, - InferMaskFrom, - InferMaskTo - > +> = + TOptions extends NavigateOptions< + TRouter, + InferFrom, + InferTo, + InferMaskFrom, + InferMaskTo + > + ? TOptions + : NavigateOptions< + TRouter, + InferFrom, + InferTo, + InferMaskFrom, + InferMaskTo + > export type ValidateNavigateOptionsArray< TRouter extends AnyRouter = RegisteredRouter, @@ -107,21 +108,22 @@ export type ValidateRedirectOptions< TRouter extends AnyRouter = RegisteredRouter, TOptions = unknown, TDefaultFrom extends string = string, -> = TOptions extends RedirectOptions< - TRouter, - InferFrom, - InferTo, - InferMaskFrom, - InferMaskTo -> - ? TOptions - : RedirectOptions< - TRouter, - InferFrom, - InferTo, - InferMaskFrom, - InferMaskTo - > +> = + TOptions extends RedirectOptions< + TRouter, + InferFrom, + InferTo, + InferMaskFrom, + InferMaskTo + > + ? TOptions + : RedirectOptions< + TRouter, + InferFrom, + InferTo, + InferMaskFrom, + InferMaskTo + > export type ValidateRedirectOptionsArray< TRouter extends AnyRouter = RegisteredRouter, @@ -180,16 +182,17 @@ export type ValidateUseSearchResult< export type ValidateUseParamsResult< TOptions, TRouter extends AnyRouter = RegisteredRouter, -> = TOptions extends UseParamsResult< - TRouter, - InferFrom, - InferStrict, - InferSelected -> - ? TOptions - : UseParamsResult< - TRouter, - InferFrom, - InferStrict, - InferSelected - > +> = + TOptions extends UseParamsResult< + TRouter, + InferFrom, + InferStrict, + InferSelected + > + ? TOptions + : UseParamsResult< + TRouter, + InferFrom, + InferStrict, + InferSelected + > From 80f7735ce99b30f4eabcb8057e81fdc0cbff4b9e Mon Sep 17 00:00:00 2001 From: Birk Skyum Date: Mon, 24 Nov 2025 11:30:52 +0100 Subject: [PATCH 3/7] reset worker-config --- .../basic-cloudflare/worker-configuration.d.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/e2e/solid-start/basic-cloudflare/worker-configuration.d.ts b/e2e/solid-start/basic-cloudflare/worker-configuration.d.ts index cb3e271c882..b0b47f39468 100644 --- a/e2e/solid-start/basic-cloudflare/worker-configuration.d.ts +++ b/e2e/solid-start/basic-cloudflare/worker-configuration.d.ts @@ -2,19 +2,16 @@ // Generated by Wrangler by running `wrangler types` (hash: b11df627d8b3c51b1bf3230a546b0f20) // Runtime types generated with workerd@1.20251118.0 2025-09-24 nodejs_compat declare namespace Cloudflare { - interface Env { - MY_VAR: 'Hello from Cloudflare' - } + interface Env { + MY_VAR: "Hello from Cloudflare"; + } } interface Env extends Cloudflare.Env {} type StringifyValues> = { - [Binding in keyof EnvType]: EnvType[Binding] extends string - ? EnvType[Binding] - : string -} + [Binding in keyof EnvType]: EnvType[Binding] extends string ? EnvType[Binding] : string; +}; declare namespace NodeJS { - interface ProcessEnv - extends StringifyValues> {} + interface ProcessEnv extends StringifyValues> {} } // Begin runtime types From 7063aca6113a9d87c52cb9e8ed495fd7f64a23e5 Mon Sep 17 00:00:00 2001 From: Birk Skyum Date: Mon, 24 Nov 2025 21:37:46 +0100 Subject: [PATCH 4/7] lint --- packages/react-router/src/typePrimitives.ts | 1 - packages/react-router/tests/validateLinkOptions.test.tsx | 4 ++-- packages/router-core/src/typePrimitives.ts | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/react-router/src/typePrimitives.ts b/packages/react-router/src/typePrimitives.ts index 2f7cdc3b13e..2f400702a39 100644 --- a/packages/react-router/src/typePrimitives.ts +++ b/packages/react-router/src/typePrimitives.ts @@ -1,6 +1,5 @@ import type { AnyRouter, - Constrain, InferFrom, InferMaskFrom, InferMaskTo, diff --git a/packages/react-router/tests/validateLinkOptions.test.tsx b/packages/react-router/tests/validateLinkOptions.test.tsx index 20b2e908fa2..3aa6ed5764b 100644 --- a/packages/react-router/tests/validateLinkOptions.test.tsx +++ b/packages/react-router/tests/validateLinkOptions.test.tsx @@ -2,8 +2,8 @@ import { describe, expect, test } from 'vitest' import { createFileRoute } from '../src/fileRoute' import type { ValidateLinkOptions, - ValidateUseSearchOptions, ValidateUseParamsOptions, + ValidateUseSearchOptions, } from '../src/typePrimitives' import type { ValidateNavigateOptions, @@ -54,7 +54,7 @@ describe('Validation types regression tests', () => { test('should work with array of ValidateLinkOptions', () => { const route = createFileRoute('/dashboard')({ loader: () => { - const breadcrumbs: ValidateLinkOptions[] = [ + const breadcrumbs: Array = [ { to: '/' }, { to: '/dashboard' }, ] diff --git a/packages/router-core/src/typePrimitives.ts b/packages/router-core/src/typePrimitives.ts index 3b6875e92f1..7c46710718e 100644 --- a/packages/router-core/src/typePrimitives.ts +++ b/packages/router-core/src/typePrimitives.ts @@ -10,7 +10,7 @@ import type { RouteIds } from './routeInfo' import type { AnyRouter, RegisteredRouter } from './router' import type { UseParamsResult } from './useParams' import type { UseSearchResult } from './useSearch' -import type { Constrain, ConstrainLiteral } from './utils' +import type { ConstrainLiteral } from './utils' export type ValidateFromPath< TRouter extends AnyRouter = RegisteredRouter, From ae351d9318247daa04133d70caacdcf9775520a9 Mon Sep 17 00:00:00 2001 From: swarnim02 Date: Tue, 25 Nov 2025 22:20:07 +0530 Subject: [PATCH 5/7] remove AI generated documentation files --- .../tests/validateLinkOptions.test.tsx | 143 ------------------ packages/solid-router/src/typePrimitives.ts | 72 +++++---- 2 files changed, 44 insertions(+), 171 deletions(-) delete mode 100644 packages/react-router/tests/validateLinkOptions.test.tsx diff --git a/packages/react-router/tests/validateLinkOptions.test.tsx b/packages/react-router/tests/validateLinkOptions.test.tsx deleted file mode 100644 index 3aa6ed5764b..00000000000 --- a/packages/react-router/tests/validateLinkOptions.test.tsx +++ /dev/null @@ -1,143 +0,0 @@ -import { describe, expect, test } from 'vitest' -import { createFileRoute } from '../src/fileRoute' -import type { - ValidateLinkOptions, - ValidateUseParamsOptions, - ValidateUseSearchOptions, -} from '../src/typePrimitives' -import type { - ValidateNavigateOptions, - ValidateRedirectOptions, -} from '@tanstack/router-core' - -describe('Validation types regression tests', () => { - test('should not cause TypeScript circular reference error in loader return type', () => { - // This test ensures that ValidateLinkOptions can be used in loader return types - // without causing the TypeScript error: - // 'loader' implicitly has return type 'any' because it does not have a return type annotation - - const route = createFileRoute('/user/$userId')({ - loader: (): { breadcrumbs: ValidateLinkOptions } => { - const breadcrumbs: ValidateLinkOptions = { - to: '/user/$userId', - params: { userId: '123' }, - } - - return { - breadcrumbs, - } - }, - component: () =>
User
, - }) - - expect(route).toBeDefined() - }) - - test('should work with ValidateLinkOptions directly in loader', () => { - const route = createFileRoute('/profile/$userId')({ - loader: () => { - const linkOptions: ValidateLinkOptions = { - to: '/profile/$userId', - params: { userId: '456' }, - } - - return { - navigation: linkOptions, - } - }, - component: () =>
Profile
, - }) - - expect(route).toBeDefined() - }) - - test('should work with array of ValidateLinkOptions', () => { - const route = createFileRoute('/dashboard')({ - loader: () => { - const breadcrumbs: Array = [ - { to: '/' }, - { to: '/dashboard' }, - ] - - return { - breadcrumbs, - } - }, - component: () =>
Dashboard
, - }) - - expect(route).toBeDefined() - }) - - test('should work with ValidateNavigateOptions in loader', () => { - const route = createFileRoute('/navigate-test')({ - loader: () => { - const navOptions: ValidateNavigateOptions = { - to: '/dashboard', - } - - return { - navOptions, - } - }, - component: () =>
Navigate Test
, - }) - - expect(route).toBeDefined() - }) - - test('should work with ValidateRedirectOptions in loader', () => { - const route = createFileRoute('/redirect-test')({ - loader: () => { - const redirectOptions: ValidateRedirectOptions = { - to: '/login', - } - - return { - redirectOptions, - } - }, - component: () =>
Redirect Test
, - }) - - expect(route).toBeDefined() - }) - - test('should work with ValidateUseSearchOptions in loader', () => { - const route = createFileRoute('/search-test')({ - loader: () => { - const searchOptions: ValidateUseSearchOptions<{ - from: '/search-test' - }> = { - from: '/search-test', - } - - return { - searchOptions, - } - }, - component: () =>
Search Test
, - }) - - expect(route).toBeDefined() - }) - - test('should work with ValidateUseParamsOptions in loader', () => { - const route = createFileRoute('/params-test/$id')({ - loader: () => { - const paramsOptions: ValidateUseParamsOptions<{ - from: '/params-test/$id' - }> = { - from: '/params-test/$id', - } - - return { - paramsOptions, - } - }, - component: () =>
Params Test
, - }) - - expect(route).toBeDefined() - }) -}) diff --git a/packages/solid-router/src/typePrimitives.ts b/packages/solid-router/src/typePrimitives.ts index b134cb8959b..a34c1708b94 100644 --- a/packages/solid-router/src/typePrimitives.ts +++ b/packages/solid-router/src/typePrimitives.ts @@ -19,17 +19,23 @@ export type ValidateLinkOptions< TOptions = unknown, TDefaultFrom extends string = string, TComp = 'a', -> = Constrain< - TOptions, - LinkComponentProps< - TComp, - TRouter, - InferFrom, - InferTo, - InferMaskFrom, - InferMaskTo - > +> = TOptions extends LinkComponentProps< + TComp, + TRouter, + InferFrom, + InferTo, + InferMaskFrom, + InferMaskTo > + ? TOptions + : LinkComponentProps< + TComp, + TRouter, + InferFrom, + InferTo, + InferMaskFrom, + InferMaskTo + > export type ValidateLinkOptionsArray< TRouter extends AnyRouter = RegisteredRouter, @@ -48,27 +54,37 @@ export type ValidateLinkOptionsArray< export type ValidateUseSearchOptions< TOptions, TRouter extends AnyRouter = RegisteredRouter, -> = Constrain< - TOptions, - UseSearchOptions< - TRouter, - InferFrom, - InferStrict, - InferShouldThrow, - InferSelected - > +> = TOptions extends UseSearchOptions< + TRouter, + InferFrom, + InferStrict, + InferShouldThrow, + InferSelected > + ? TOptions + : UseSearchOptions< + TRouter, + InferFrom, + InferStrict, + InferShouldThrow, + InferSelected + > export type ValidateUseParamsOptions< TOptions, TRouter extends AnyRouter = RegisteredRouter, -> = Constrain< - TOptions, - UseParamsOptions< - TRouter, - InferFrom, - InferStrict, - InferShouldThrow, - InferSelected - > +> = TOptions extends UseParamsOptions< + TRouter, + InferFrom, + InferStrict, + InferShouldThrow, + InferSelected > + ? TOptions + : UseParamsOptions< + TRouter, + InferFrom, + InferStrict, + InferShouldThrow, + InferSelected + > From f66e4a21e4ace339af5d206d5ad47543eb6484fd Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Tue, 25 Nov 2025 19:27:46 +0000 Subject: [PATCH 6/7] ci: apply automated fixes --- packages/solid-router/src/typePrimitives.ts | 97 +++++++++++---------- 1 file changed, 50 insertions(+), 47 deletions(-) diff --git a/packages/solid-router/src/typePrimitives.ts b/packages/solid-router/src/typePrimitives.ts index a34c1708b94..de5686006db 100644 --- a/packages/solid-router/src/typePrimitives.ts +++ b/packages/solid-router/src/typePrimitives.ts @@ -19,23 +19,24 @@ export type ValidateLinkOptions< TOptions = unknown, TDefaultFrom extends string = string, TComp = 'a', -> = TOptions extends LinkComponentProps< - TComp, - TRouter, - InferFrom, - InferTo, - InferMaskFrom, - InferMaskTo -> - ? TOptions - : LinkComponentProps< - TComp, - TRouter, - InferFrom, - InferTo, - InferMaskFrom, - InferMaskTo - > +> = + TOptions extends LinkComponentProps< + TComp, + TRouter, + InferFrom, + InferTo, + InferMaskFrom, + InferMaskTo + > + ? TOptions + : LinkComponentProps< + TComp, + TRouter, + InferFrom, + InferTo, + InferMaskFrom, + InferMaskTo + > export type ValidateLinkOptionsArray< TRouter extends AnyRouter = RegisteredRouter, @@ -54,37 +55,39 @@ export type ValidateLinkOptionsArray< export type ValidateUseSearchOptions< TOptions, TRouter extends AnyRouter = RegisteredRouter, -> = TOptions extends UseSearchOptions< - TRouter, - InferFrom, - InferStrict, - InferShouldThrow, - InferSelected -> - ? TOptions - : UseSearchOptions< - TRouter, - InferFrom, - InferStrict, - InferShouldThrow, - InferSelected - > +> = + TOptions extends UseSearchOptions< + TRouter, + InferFrom, + InferStrict, + InferShouldThrow, + InferSelected + > + ? TOptions + : UseSearchOptions< + TRouter, + InferFrom, + InferStrict, + InferShouldThrow, + InferSelected + > export type ValidateUseParamsOptions< TOptions, TRouter extends AnyRouter = RegisteredRouter, -> = TOptions extends UseParamsOptions< - TRouter, - InferFrom, - InferStrict, - InferShouldThrow, - InferSelected -> - ? TOptions - : UseParamsOptions< - TRouter, - InferFrom, - InferStrict, - InferShouldThrow, - InferSelected - > +> = + TOptions extends UseParamsOptions< + TRouter, + InferFrom, + InferStrict, + InferShouldThrow, + InferSelected + > + ? TOptions + : UseParamsOptions< + TRouter, + InferFrom, + InferStrict, + InferShouldThrow, + InferSelected + > From 7a5c8eeb10b86db96fdde125a3af52cc351b4302 Mon Sep 17 00:00:00 2001 From: swarnim02 Date: Fri, 28 Nov 2025 03:13:31 +0530 Subject: [PATCH 7/7] fix: resolve validation types circular reference and fix login route structure --- .../src/routeTree.gen.ts | 93 --- .../src/routes/_layout.tsx | 4 +- .../src/routes/_layout/_layout-2.tsx | 4 +- .../src/routes/_layout/_layout-2/layout-a.tsx | 3 +- .../src/routes/_layout/_layout-2/layout-b.tsx | 3 +- .../src/routes/index.tsx | 3 +- .../src/routes/posts.$postId.tsx | 4 +- .../src/routes/posts.index.tsx | 3 +- .../src/routes/posts.tsx | 4 +- .../src/routes/viewport-test.tsx | 3 +- .../src/routes/without-loader.tsx | 3 +- .../src/routeTree.gen.ts | 28 +- .../src/routeTree.gen.ts | 93 --- .../src/routes/_layout.tsx | 4 +- .../src/routes/_layout/_layout-2.tsx | 4 +- .../src/routes/_layout/_layout-2/layout-a.tsx | 3 +- .../src/routes/_layout/_layout-2/layout-b.tsx | 3 +- .../src/routes/index.tsx | 3 +- .../src/routes/posts.$postId.tsx | 4 +- .../src/routes/posts.index.tsx | 3 +- .../src/routes/posts.tsx | 4 +- .../src/routes/viewport-test.tsx | 3 +- .../src/routes/without-loader.tsx | 3 +- .../src/routeTree.gen.ts | 28 +- .../test-results/.last-run.json | 11 + .../test-results/.last-run.json | 8 + .../src/routeTree.gen.ts | 539 +++++++----------- .../src/routes/login.tsx | 1 - .../start-clerk-basic/src/routeTree.gen.ts | 4 +- .../src/routes/login.tsx | 1 - 30 files changed, 267 insertions(+), 607 deletions(-) create mode 100644 e2e/solid-start/basic-solid-query/test-results/.last-run.json create mode 100644 e2e/solid-start/query-integration/test-results/.last-run.json diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routeTree.gen.ts b/e2e/react-router/basic-file-based-code-splitting/src/routeTree.gen.ts index 442312342af..b90c69bd5f4 100644 --- a/e2e/react-router/basic-file-based-code-splitting/src/routeTree.gen.ts +++ b/e2e/react-router/basic-file-based-code-splitting/src/routeTree.gen.ts @@ -8,8 +8,6 @@ // You should NOT make any changes in this file as it will be overwritten. // Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. -import type { CreateFileRoute, FileRoutesByPath } from '@tanstack/react-router' - import { Route as rootRouteImport } from './routes/__root' import { Route as WithoutLoaderRouteImport } from './routes/without-loader' import { Route as ViewportTestRouteImport } from './routes/viewport-test' @@ -220,97 +218,6 @@ declare module '@tanstack/react-router' { } } -declare module './routes/index' { - const createFileRoute: CreateFileRoute< - '/', - FileRoutesByPath['/']['parentRoute'], - FileRoutesByPath['/']['id'], - FileRoutesByPath['/']['path'], - FileRoutesByPath['/']['fullPath'] - > -} -declare module './routes/_layout' { - const createFileRoute: CreateFileRoute< - '/_layout', - FileRoutesByPath['/_layout']['parentRoute'], - FileRoutesByPath['/_layout']['id'], - FileRoutesByPath['/_layout']['path'], - FileRoutesByPath['/_layout']['fullPath'] - > -} -declare module './routes/posts' { - const createFileRoute: CreateFileRoute< - '/posts', - FileRoutesByPath['/posts']['parentRoute'], - FileRoutesByPath['/posts']['id'], - FileRoutesByPath['/posts']['path'], - FileRoutesByPath['/posts']['fullPath'] - > -} -declare module './routes/viewport-test' { - const createFileRoute: CreateFileRoute< - '/viewport-test', - FileRoutesByPath['/viewport-test']['parentRoute'], - FileRoutesByPath['/viewport-test']['id'], - FileRoutesByPath['/viewport-test']['path'], - FileRoutesByPath['/viewport-test']['fullPath'] - > -} -declare module './routes/without-loader' { - const createFileRoute: CreateFileRoute< - '/without-loader', - FileRoutesByPath['/without-loader']['parentRoute'], - FileRoutesByPath['/without-loader']['id'], - FileRoutesByPath['/without-loader']['path'], - FileRoutesByPath['/without-loader']['fullPath'] - > -} -declare module './routes/_layout/_layout-2' { - const createFileRoute: CreateFileRoute< - '/_layout/_layout-2', - FileRoutesByPath['/_layout/_layout-2']['parentRoute'], - FileRoutesByPath['/_layout/_layout-2']['id'], - FileRoutesByPath['/_layout/_layout-2']['path'], - FileRoutesByPath['/_layout/_layout-2']['fullPath'] - > -} -declare module './routes/posts.$postId' { - const createFileRoute: CreateFileRoute< - '/posts/$postId', - FileRoutesByPath['/posts/$postId']['parentRoute'], - FileRoutesByPath['/posts/$postId']['id'], - FileRoutesByPath['/posts/$postId']['path'], - FileRoutesByPath['/posts/$postId']['fullPath'] - > -} -declare module './routes/posts.index' { - const createFileRoute: CreateFileRoute< - '/posts/', - FileRoutesByPath['/posts/']['parentRoute'], - FileRoutesByPath['/posts/']['id'], - FileRoutesByPath['/posts/']['path'], - FileRoutesByPath['/posts/']['fullPath'] - > -} -declare module './routes/_layout/_layout-2/layout-a' { - const createFileRoute: CreateFileRoute< - '/_layout/_layout-2/layout-a', - FileRoutesByPath['/_layout/_layout-2/layout-a']['parentRoute'], - FileRoutesByPath['/_layout/_layout-2/layout-a']['id'], - FileRoutesByPath['/_layout/_layout-2/layout-a']['path'], - FileRoutesByPath['/_layout/_layout-2/layout-a']['fullPath'] - > -} -declare module './routes/_layout/_layout-2/layout-b' { - const createFileRoute: CreateFileRoute< - '/_layout/_layout-2/layout-b', - FileRoutesByPath['/_layout/_layout-2/layout-b']['parentRoute'], - FileRoutesByPath['/_layout/_layout-2/layout-b']['id'], - FileRoutesByPath['/_layout/_layout-2/layout-b']['path'], - FileRoutesByPath['/_layout/_layout-2/layout-b']['fullPath'] - > -} - interface LayoutLayout2RouteChildren { LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout.tsx index 5c4a461d8d9..02ddbb1cd94 100644 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout.tsx +++ b/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout.tsx @@ -1,6 +1,6 @@ -import { Outlet } from '@tanstack/react-router' +import { Outlet, createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute({ +export const Route = createFileRoute('/_layout')({ component: LayoutComponent, }) diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2.tsx index 483b910862b..3b7dbf29031 100644 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2.tsx +++ b/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2.tsx @@ -1,6 +1,6 @@ -import { Link, Outlet } from '@tanstack/react-router' +import { Link, Outlet, createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute({ +export const Route = createFileRoute('/_layout/_layout-2')({ component: LayoutComponent, }) diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx index a190b242028..ed2dea88006 100644 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx +++ b/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx @@ -1,4 +1,5 @@ -export const Route = createFileRoute({ +import { createFileRoute } from '@tanstack/react-router' +export const Route = createFileRoute('/_layout/_layout-2/layout-a')({ component: LayoutAComponent, }) diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx index 505f8f6fbf8..4799d403e91 100644 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx +++ b/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx @@ -1,4 +1,5 @@ -export const Route = createFileRoute({ +import { createFileRoute } from '@tanstack/react-router' +export const Route = createFileRoute('/_layout/_layout-2/layout-b')({ component: LayoutBComponent, }) diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/index.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/index.tsx index b23956ae17a..0a5b7572ba2 100644 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/index.tsx +++ b/e2e/react-router/basic-file-based-code-splitting/src/routes/index.tsx @@ -1,6 +1,7 @@ +import { createFileRoute } from '@tanstack/react-router' import * as React from 'react' -export const Route = createFileRoute({ +export const Route = createFileRoute('/')({ component: Home, }) diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx index 805fa37ed3c..47d1148be22 100644 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx +++ b/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx @@ -1,9 +1,9 @@ import * as React from 'react' -import { ErrorComponent } from '@tanstack/react-router' +import { ErrorComponent, createFileRoute } from '@tanstack/react-router' import { fetchPost } from '../posts' import type { ErrorComponentProps } from '@tanstack/react-router' -export const Route = createFileRoute({ +export const Route = createFileRoute('/posts/$postId')({ loader: async ({ params: { postId } }) => fetchPost(postId), errorComponent: PostErrorComponent as any, notFoundComponent: () => { diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.index.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.index.tsx index fdbe5865e58..c6b65f18923 100644 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.index.tsx +++ b/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.index.tsx @@ -1,6 +1,7 @@ +import { createFileRoute } from '@tanstack/react-router' import * as React from 'react' -export const Route = createFileRoute({ +export const Route = createFileRoute('/posts/')({ component: PostsIndexComponent, }) diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.tsx index 4469b2216ab..c7a09ed7f82 100644 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.tsx +++ b/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.tsx @@ -1,8 +1,8 @@ import * as React from 'react' -import { Link, Outlet } from '@tanstack/react-router' +import { Link, Outlet, createFileRoute } from '@tanstack/react-router' import { fetchPosts } from '../posts' -export const Route = createFileRoute({ +export const Route = createFileRoute('/posts')({ loader: fetchPosts, component: PostsComponent, }) diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx index b182feb7b15..81fd50c98b9 100644 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx +++ b/e2e/react-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx @@ -1,3 +1,4 @@ -export const Route = createFileRoute({ +import { createFileRoute } from '@tanstack/react-router' +export const Route = createFileRoute('/viewport-test')({ component: () =>
Hello /viewport-test!
, }) diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/without-loader.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/without-loader.tsx index af692bdaca3..a4f4fac74e1 100644 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/without-loader.tsx +++ b/e2e/react-router/basic-file-based-code-splitting/src/routes/without-loader.tsx @@ -1,3 +1,4 @@ -export const Route = createFileRoute({ +import { createFileRoute } from '@tanstack/react-router' +export const Route = createFileRoute('/without-loader')({ component: () =>
Hello /without-loader!
, }) diff --git a/e2e/react-router/basic-react-query-file-based/src/routeTree.gen.ts b/e2e/react-router/basic-react-query-file-based/src/routeTree.gen.ts index 88ecb63891b..170a6beadb7 100644 --- a/e2e/react-router/basic-react-query-file-based/src/routeTree.gen.ts +++ b/e2e/react-router/basic-react-query-file-based/src/routeTree.gen.ts @@ -15,7 +15,6 @@ import { Route as IndexRouteImport } from './routes/index' import { Route as PostsIndexRouteImport } from './routes/posts.index' import { Route as PostsPostIdRouteImport } from './routes/posts.$postId' import { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2' -import { Route as TransitionCountQueryRouteImport } from './routes/transition/count/query' import { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b' import { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a' @@ -47,11 +46,6 @@ const LayoutLayout2Route = LayoutLayout2RouteImport.update({ id: '/_layout-2', getParentRoute: () => LayoutRoute, } as any) -const TransitionCountQueryRoute = TransitionCountQueryRouteImport.update({ - id: '/transition/count/query', - path: '/transition/count/query', - getParentRoute: () => rootRouteImport, -} as any) const LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({ id: '/layout-b', path: '/layout-b', @@ -70,7 +64,6 @@ export interface FileRoutesByFullPath { '/posts/': typeof PostsIndexRoute '/layout-a': typeof LayoutLayout2LayoutARoute '/layout-b': typeof LayoutLayout2LayoutBRoute - '/transition/count/query': typeof TransitionCountQueryRoute } export interface FileRoutesByTo { '/': typeof IndexRoute @@ -78,7 +71,6 @@ export interface FileRoutesByTo { '/posts': typeof PostsIndexRoute '/layout-a': typeof LayoutLayout2LayoutARoute '/layout-b': typeof LayoutLayout2LayoutBRoute - '/transition/count/query': typeof TransitionCountQueryRoute } export interface FileRoutesById { __root__: typeof rootRouteImport @@ -90,7 +82,6 @@ export interface FileRoutesById { '/posts/': typeof PostsIndexRoute '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute - '/transition/count/query': typeof TransitionCountQueryRoute } export interface FileRouteTypes { fileRoutesByFullPath: FileRoutesByFullPath @@ -101,15 +92,8 @@ export interface FileRouteTypes { | '/posts/' | '/layout-a' | '/layout-b' - | '/transition/count/query' fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/posts/$postId' - | '/posts' - | '/layout-a' - | '/layout-b' - | '/transition/count/query' + to: '/' | '/posts/$postId' | '/posts' | '/layout-a' | '/layout-b' id: | '__root__' | '/' @@ -120,14 +104,12 @@ export interface FileRouteTypes { | '/posts/' | '/_layout/_layout-2/layout-a' | '/_layout/_layout-2/layout-b' - | '/transition/count/query' fileRoutesById: FileRoutesById } export interface RootRouteChildren { IndexRoute: typeof IndexRoute LayoutRoute: typeof LayoutRouteWithChildren PostsRoute: typeof PostsRouteWithChildren - TransitionCountQueryRoute: typeof TransitionCountQueryRoute } declare module '@tanstack/react-router' { @@ -174,13 +156,6 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof LayoutLayout2RouteImport parentRoute: typeof LayoutRoute } - '/transition/count/query': { - id: '/transition/count/query' - path: '/transition/count/query' - fullPath: '/transition/count/query' - preLoaderRoute: typeof TransitionCountQueryRouteImport - parentRoute: typeof rootRouteImport - } '/_layout/_layout-2/layout-b': { id: '/_layout/_layout-2/layout-b' path: '/layout-b' @@ -239,7 +214,6 @@ const rootRouteChildren: RootRouteChildren = { IndexRoute: IndexRoute, LayoutRoute: LayoutRouteWithChildren, PostsRoute: PostsRouteWithChildren, - TransitionCountQueryRoute: TransitionCountQueryRoute, } export const routeTree = rootRouteImport ._addFileChildren(rootRouteChildren) diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routeTree.gen.ts b/e2e/solid-router/basic-file-based-code-splitting/src/routeTree.gen.ts index f52487e717b..4cdb554efff 100644 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routeTree.gen.ts +++ b/e2e/solid-router/basic-file-based-code-splitting/src/routeTree.gen.ts @@ -8,8 +8,6 @@ // You should NOT make any changes in this file as it will be overwritten. // Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. -import type { CreateFileRoute, FileRoutesByPath } from '@tanstack/solid-router' - import { Route as rootRouteImport } from './routes/__root' import { Route as WithoutLoaderRouteImport } from './routes/without-loader' import { Route as ViewportTestRouteImport } from './routes/viewport-test' @@ -220,97 +218,6 @@ declare module '@tanstack/solid-router' { } } -declare module './routes/index' { - const createFileRoute: CreateFileRoute< - '/', - FileRoutesByPath['/']['parentRoute'], - FileRoutesByPath['/']['id'], - FileRoutesByPath['/']['path'], - FileRoutesByPath['/']['fullPath'] - > -} -declare module './routes/_layout' { - const createFileRoute: CreateFileRoute< - '/_layout', - FileRoutesByPath['/_layout']['parentRoute'], - FileRoutesByPath['/_layout']['id'], - FileRoutesByPath['/_layout']['path'], - FileRoutesByPath['/_layout']['fullPath'] - > -} -declare module './routes/posts' { - const createFileRoute: CreateFileRoute< - '/posts', - FileRoutesByPath['/posts']['parentRoute'], - FileRoutesByPath['/posts']['id'], - FileRoutesByPath['/posts']['path'], - FileRoutesByPath['/posts']['fullPath'] - > -} -declare module './routes/viewport-test' { - const createFileRoute: CreateFileRoute< - '/viewport-test', - FileRoutesByPath['/viewport-test']['parentRoute'], - FileRoutesByPath['/viewport-test']['id'], - FileRoutesByPath['/viewport-test']['path'], - FileRoutesByPath['/viewport-test']['fullPath'] - > -} -declare module './routes/without-loader' { - const createFileRoute: CreateFileRoute< - '/without-loader', - FileRoutesByPath['/without-loader']['parentRoute'], - FileRoutesByPath['/without-loader']['id'], - FileRoutesByPath['/without-loader']['path'], - FileRoutesByPath['/without-loader']['fullPath'] - > -} -declare module './routes/_layout/_layout-2' { - const createFileRoute: CreateFileRoute< - '/_layout/_layout-2', - FileRoutesByPath['/_layout/_layout-2']['parentRoute'], - FileRoutesByPath['/_layout/_layout-2']['id'], - FileRoutesByPath['/_layout/_layout-2']['path'], - FileRoutesByPath['/_layout/_layout-2']['fullPath'] - > -} -declare module './routes/posts.$postId' { - const createFileRoute: CreateFileRoute< - '/posts/$postId', - FileRoutesByPath['/posts/$postId']['parentRoute'], - FileRoutesByPath['/posts/$postId']['id'], - FileRoutesByPath['/posts/$postId']['path'], - FileRoutesByPath['/posts/$postId']['fullPath'] - > -} -declare module './routes/posts.index' { - const createFileRoute: CreateFileRoute< - '/posts/', - FileRoutesByPath['/posts/']['parentRoute'], - FileRoutesByPath['/posts/']['id'], - FileRoutesByPath['/posts/']['path'], - FileRoutesByPath['/posts/']['fullPath'] - > -} -declare module './routes/_layout/_layout-2/layout-a' { - const createFileRoute: CreateFileRoute< - '/_layout/_layout-2/layout-a', - FileRoutesByPath['/_layout/_layout-2/layout-a']['parentRoute'], - FileRoutesByPath['/_layout/_layout-2/layout-a']['id'], - FileRoutesByPath['/_layout/_layout-2/layout-a']['path'], - FileRoutesByPath['/_layout/_layout-2/layout-a']['fullPath'] - > -} -declare module './routes/_layout/_layout-2/layout-b' { - const createFileRoute: CreateFileRoute< - '/_layout/_layout-2/layout-b', - FileRoutesByPath['/_layout/_layout-2/layout-b']['parentRoute'], - FileRoutesByPath['/_layout/_layout-2/layout-b']['id'], - FileRoutesByPath['/_layout/_layout-2/layout-b']['path'], - FileRoutesByPath['/_layout/_layout-2/layout-b']['fullPath'] - > -} - interface LayoutLayout2RouteChildren { LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout.tsx index c5491756389..d43b4ef5f5e 100644 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout.tsx +++ b/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout.tsx @@ -1,6 +1,6 @@ -import { Outlet } from '@tanstack/solid-router' +import { Outlet, createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute({ +export const Route = createFileRoute('/_layout')({ component: LayoutComponent, }) diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2.tsx index efeca5ce860..7a5a3623a03 100644 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2.tsx +++ b/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2.tsx @@ -1,6 +1,6 @@ -import { Link, Outlet } from '@tanstack/solid-router' +import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute({ +export const Route = createFileRoute('/_layout/_layout-2')({ component: LayoutComponent, }) diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx index a190b242028..997e6caf800 100644 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx +++ b/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx @@ -1,4 +1,5 @@ -export const Route = createFileRoute({ +import { createFileRoute } from '@tanstack/solid-router' +export const Route = createFileRoute('/_layout/_layout-2/layout-a')({ component: LayoutAComponent, }) diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx index 505f8f6fbf8..70135c5809d 100644 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx +++ b/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx @@ -1,4 +1,5 @@ -export const Route = createFileRoute({ +import { createFileRoute } from '@tanstack/solid-router' +export const Route = createFileRoute('/_layout/_layout-2/layout-b')({ component: LayoutBComponent, }) diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/index.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/index.tsx index 510db79b738..3f905db60c6 100644 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/index.tsx +++ b/e2e/solid-router/basic-file-based-code-splitting/src/routes/index.tsx @@ -1,4 +1,5 @@ -export const Route = createFileRoute({ +import { createFileRoute } from '@tanstack/solid-router' +export const Route = createFileRoute('/')({ component: Home, }) diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx index e23c29a21a5..105f08d64e1 100644 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx +++ b/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx @@ -1,4 +1,4 @@ -import { ErrorComponent } from '@tanstack/solid-router' +import { ErrorComponent, createFileRoute } from '@tanstack/solid-router' import { fetchPost } from '../posts' import type { ErrorComponentProps } from '@tanstack/solid-router' @@ -6,7 +6,7 @@ export function PostErrorComponent({ error }: ErrorComponentProps) { return } -export const Route = createFileRoute({ +export const Route = createFileRoute('/posts/$postId')({ loader: async ({ params: { postId } }) => fetchPost(postId), errorComponent: PostErrorComponent as any, notFoundComponent: () => { diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.index.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.index.tsx index 13529228bb4..812b581e0aa 100644 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.index.tsx +++ b/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.index.tsx @@ -1,4 +1,5 @@ -export const Route = createFileRoute({ +import { createFileRoute } from '@tanstack/solid-router' +export const Route = createFileRoute('/posts/')({ component: PostsIndexComponent, }) diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.tsx index 2e28f9beb34..11a999f50aa 100644 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.tsx +++ b/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.tsx @@ -1,7 +1,7 @@ -import { Link, Outlet } from '@tanstack/solid-router' +import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' import { fetchPosts } from '../posts' -export const Route = createFileRoute({ +export const Route = createFileRoute('/posts')({ loader: fetchPosts, component: PostsComponent, }) diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx index b182feb7b15..c199bc56e01 100644 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx +++ b/e2e/solid-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx @@ -1,3 +1,4 @@ -export const Route = createFileRoute({ +import { createFileRoute } from '@tanstack/solid-router' +export const Route = createFileRoute('/viewport-test')({ component: () =>
Hello /viewport-test!
, }) diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/without-loader.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/without-loader.tsx index af692bdaca3..a7bf51fafb2 100644 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/without-loader.tsx +++ b/e2e/solid-router/basic-file-based-code-splitting/src/routes/without-loader.tsx @@ -1,3 +1,4 @@ -export const Route = createFileRoute({ +import { createFileRoute } from '@tanstack/solid-router' +export const Route = createFileRoute('/without-loader')({ component: () =>
Hello /without-loader!
, }) diff --git a/e2e/solid-router/basic-solid-query-file-based/src/routeTree.gen.ts b/e2e/solid-router/basic-solid-query-file-based/src/routeTree.gen.ts index 2140687b184..325f0ccfc8f 100644 --- a/e2e/solid-router/basic-solid-query-file-based/src/routeTree.gen.ts +++ b/e2e/solid-router/basic-solid-query-file-based/src/routeTree.gen.ts @@ -15,7 +15,6 @@ import { Route as IndexRouteImport } from './routes/index' import { Route as PostsIndexRouteImport } from './routes/posts.index' import { Route as PostsPostIdRouteImport } from './routes/posts.$postId' import { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2' -import { Route as TransitionCountQueryRouteImport } from './routes/transition/count/query' import { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b' import { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a' @@ -47,11 +46,6 @@ const LayoutLayout2Route = LayoutLayout2RouteImport.update({ id: '/_layout-2', getParentRoute: () => LayoutRoute, } as any) -const TransitionCountQueryRoute = TransitionCountQueryRouteImport.update({ - id: '/transition/count/query', - path: '/transition/count/query', - getParentRoute: () => rootRouteImport, -} as any) const LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({ id: '/layout-b', path: '/layout-b', @@ -70,7 +64,6 @@ export interface FileRoutesByFullPath { '/posts/': typeof PostsIndexRoute '/layout-a': typeof LayoutLayout2LayoutARoute '/layout-b': typeof LayoutLayout2LayoutBRoute - '/transition/count/query': typeof TransitionCountQueryRoute } export interface FileRoutesByTo { '/': typeof IndexRoute @@ -78,7 +71,6 @@ export interface FileRoutesByTo { '/posts': typeof PostsIndexRoute '/layout-a': typeof LayoutLayout2LayoutARoute '/layout-b': typeof LayoutLayout2LayoutBRoute - '/transition/count/query': typeof TransitionCountQueryRoute } export interface FileRoutesById { __root__: typeof rootRouteImport @@ -90,7 +82,6 @@ export interface FileRoutesById { '/posts/': typeof PostsIndexRoute '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute - '/transition/count/query': typeof TransitionCountQueryRoute } export interface FileRouteTypes { fileRoutesByFullPath: FileRoutesByFullPath @@ -101,15 +92,8 @@ export interface FileRouteTypes { | '/posts/' | '/layout-a' | '/layout-b' - | '/transition/count/query' fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/posts/$postId' - | '/posts' - | '/layout-a' - | '/layout-b' - | '/transition/count/query' + to: '/' | '/posts/$postId' | '/posts' | '/layout-a' | '/layout-b' id: | '__root__' | '/' @@ -120,14 +104,12 @@ export interface FileRouteTypes { | '/posts/' | '/_layout/_layout-2/layout-a' | '/_layout/_layout-2/layout-b' - | '/transition/count/query' fileRoutesById: FileRoutesById } export interface RootRouteChildren { IndexRoute: typeof IndexRoute LayoutRoute: typeof LayoutRouteWithChildren PostsRoute: typeof PostsRouteWithChildren - TransitionCountQueryRoute: typeof TransitionCountQueryRoute } declare module '@tanstack/solid-router' { @@ -174,13 +156,6 @@ declare module '@tanstack/solid-router' { preLoaderRoute: typeof LayoutLayout2RouteImport parentRoute: typeof LayoutRoute } - '/transition/count/query': { - id: '/transition/count/query' - path: '/transition/count/query' - fullPath: '/transition/count/query' - preLoaderRoute: typeof TransitionCountQueryRouteImport - parentRoute: typeof rootRouteImport - } '/_layout/_layout-2/layout-b': { id: '/_layout/_layout-2/layout-b' path: '/layout-b' @@ -239,7 +214,6 @@ const rootRouteChildren: RootRouteChildren = { IndexRoute: IndexRoute, LayoutRoute: LayoutRouteWithChildren, PostsRoute: PostsRouteWithChildren, - TransitionCountQueryRoute: TransitionCountQueryRoute, } export const routeTree = rootRouteImport ._addFileChildren(rootRouteChildren) diff --git a/e2e/solid-start/basic-solid-query/test-results/.last-run.json b/e2e/solid-start/basic-solid-query/test-results/.last-run.json new file mode 100644 index 00000000000..6a82cc0eeaa --- /dev/null +++ b/e2e/solid-start/basic-solid-query/test-results/.last-run.json @@ -0,0 +1,11 @@ +{ + "status": "failed", + "failedTests": [ + "c31ff144dc4fee3acd0a-63b89a338be79484e4bb", + "c31ff144dc4fee3acd0a-4f129c35c3de91a27f27", + "c31ff144dc4fee3acd0a-e4cccb546ad3f7426add", + "c31ff144dc4fee3acd0a-d41a04e4f89f1163e5b6", + "c31ff144dc4fee3acd0a-1172e5451c6cb8c08510", + "b1eceb8956f07dfb5861-c24942549d1750f8032a" + ] +} \ No newline at end of file diff --git a/e2e/solid-start/query-integration/test-results/.last-run.json b/e2e/solid-start/query-integration/test-results/.last-run.json new file mode 100644 index 00000000000..46a7e5b9d86 --- /dev/null +++ b/e2e/solid-start/query-integration/test-results/.last-run.json @@ -0,0 +1,8 @@ +{ + "status": "failed", + "failedTests": [ + "c31ff144dc4fee3acd0a-dcba2f2956f7c4784a04", + "c31ff144dc4fee3acd0a-76f29614b7605cade5f2", + "c31ff144dc4fee3acd0a-5c10c5421b657c714e2b" + ] +} \ No newline at end of file diff --git a/examples/react/kitchen-sink-file-based/src/routeTree.gen.ts b/examples/react/kitchen-sink-file-based/src/routeTree.gen.ts index f3accfa48e5..21ebce14db6 100644 --- a/examples/react/kitchen-sink-file-based/src/routeTree.gen.ts +++ b/examples/react/kitchen-sink-file-based/src/routeTree.gen.ts @@ -8,9 +8,7 @@ // You should NOT make any changes in this file as it will be overwritten. // Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. -// Import Routes - -import { Route as rootRoute } from './routes/__root' +import { Route as rootRouteImport } from './routes/__root' import { Route as LoginRouteImport } from './routes/login' import { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout' import { Route as AuthRouteImport } from './routes/_auth' @@ -29,103 +27,85 @@ import { Route as DashboardInvoicesIndexRouteImport } from './routes/dashboard.i import { Route as DashboardUsersUserRouteImport } from './routes/dashboard.users.user' import { Route as DashboardInvoicesInvoiceIdRouteImport } from './routes/dashboard.invoices.$invoiceId' -// Create/Update Routes - const LoginRoute = LoginRouteImport.update({ id: '/login', path: '/login', - getParentRoute: () => rootRoute, + getParentRoute: () => rootRouteImport, } as any) - const PathlessLayoutRoute = PathlessLayoutRouteImport.update({ id: '/_pathlessLayout', - getParentRoute: () => rootRoute, + getParentRoute: () => rootRouteImport, } as any) - const AuthRoute = AuthRouteImport.update({ id: '/_auth', - getParentRoute: () => rootRoute, + getParentRoute: () => rootRouteImport, } as any) - const DashboardRouteRoute = DashboardRouteRouteImport.update({ id: '/dashboard', path: '/dashboard', - getParentRoute: () => rootRoute, + getParentRoute: () => rootRouteImport, } as any) - const IndexRoute = IndexRouteImport.update({ id: '/', path: '/', - getParentRoute: () => rootRoute, + getParentRoute: () => rootRouteImport, } as any) - const ExpensiveIndexRoute = ExpensiveIndexRouteImport.update({ id: '/expensive/', path: '/expensive/', - getParentRoute: () => rootRoute, + getParentRoute: () => rootRouteImport, } as any) - const DashboardIndexRoute = DashboardIndexRouteImport.update({ id: '/', path: '/', getParentRoute: () => DashboardRouteRoute, } as any) - const PathlessLayoutRouteBRoute = PathlessLayoutRouteBRouteImport.update({ id: '/route-b', path: '/route-b', getParentRoute: () => PathlessLayoutRoute, } as any) - const PathlessLayoutRouteARoute = PathlessLayoutRouteARouteImport.update({ id: '/route-a', path: '/route-a', getParentRoute: () => PathlessLayoutRoute, } as any) - const AuthProfileRoute = AuthProfileRouteImport.update({ id: '/profile', path: '/profile', getParentRoute: () => AuthRoute, } as any) - const thisFolderIsNotInTheUrlRouteGroupRoute = thisFolderIsNotInTheUrlRouteGroupRouteImport.update({ id: '/(this-folder-is-not-in-the-url)/route-group', path: '/route-group', - getParentRoute: () => rootRoute, + getParentRoute: () => rootRouteImport, } as any) - const DashboardUsersRouteRoute = DashboardUsersRouteRouteImport.update({ id: '/users', path: '/users', getParentRoute: () => DashboardRouteRoute, } as any) - const DashboardInvoicesRouteRoute = DashboardInvoicesRouteRouteImport.update({ id: '/invoices', path: '/invoices', getParentRoute: () => DashboardRouteRoute, } as any) - const DashboardUsersIndexRoute = DashboardUsersIndexRouteImport.update({ id: '/', path: '/', getParentRoute: () => DashboardUsersRouteRoute, } as any) - const DashboardInvoicesIndexRoute = DashboardInvoicesIndexRouteImport.update({ id: '/', path: '/', getParentRoute: () => DashboardInvoicesRouteRoute, } as any) - const DashboardUsersUserRoute = DashboardUsersUserRouteImport.update({ id: '/user', path: '/user', getParentRoute: () => DashboardUsersRouteRoute, } as any) - const DashboardInvoicesInvoiceIdRoute = DashboardInvoicesInvoiceIdRouteImport.update({ id: '/$invoiceId', @@ -133,207 +113,9 @@ const DashboardInvoicesInvoiceIdRoute = getParentRoute: () => DashboardInvoicesRouteRoute, } as any) -// Populate the FileRoutesByPath interface - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRoute - } - '/dashboard': { - id: '/dashboard' - path: '/dashboard' - fullPath: '/dashboard' - preLoaderRoute: typeof DashboardRouteRouteImport - parentRoute: typeof rootRoute - } - '/_auth': { - id: '/_auth' - path: '' - fullPath: '' - preLoaderRoute: typeof AuthRouteImport - parentRoute: typeof rootRoute - } - '/_pathlessLayout': { - id: '/_pathlessLayout' - path: '' - fullPath: '' - preLoaderRoute: typeof PathlessLayoutRouteImport - parentRoute: typeof rootRoute - } - '/login': { - id: '/login' - path: '/login' - fullPath: '/login' - preLoaderRoute: typeof LoginRouteImport - parentRoute: typeof rootRoute - } - '/dashboard/invoices': { - id: '/dashboard/invoices' - path: '/invoices' - fullPath: '/dashboard/invoices' - preLoaderRoute: typeof DashboardInvoicesRouteRouteImport - parentRoute: typeof DashboardRouteRouteImport - } - '/dashboard/users': { - id: '/dashboard/users' - path: '/users' - fullPath: '/dashboard/users' - preLoaderRoute: typeof DashboardUsersRouteRouteImport - parentRoute: typeof DashboardRouteRouteImport - } - '/(this-folder-is-not-in-the-url)/route-group': { - id: '/(this-folder-is-not-in-the-url)/route-group' - path: '/route-group' - fullPath: '/route-group' - preLoaderRoute: typeof thisFolderIsNotInTheUrlRouteGroupRouteImport - parentRoute: typeof rootRoute - } - '/_auth/profile': { - id: '/_auth/profile' - path: '/profile' - fullPath: '/profile' - preLoaderRoute: typeof AuthProfileRouteImport - parentRoute: typeof AuthRouteImport - } - '/_pathlessLayout/route-a': { - id: '/_pathlessLayout/route-a' - path: '/route-a' - fullPath: '/route-a' - preLoaderRoute: typeof PathlessLayoutRouteARouteImport - parentRoute: typeof PathlessLayoutRouteImport - } - '/_pathlessLayout/route-b': { - id: '/_pathlessLayout/route-b' - path: '/route-b' - fullPath: '/route-b' - preLoaderRoute: typeof PathlessLayoutRouteBRouteImport - parentRoute: typeof PathlessLayoutRouteImport - } - '/dashboard/': { - id: '/dashboard/' - path: '/' - fullPath: '/dashboard/' - preLoaderRoute: typeof DashboardIndexRouteImport - parentRoute: typeof DashboardRouteRouteImport - } - '/expensive/': { - id: '/expensive/' - path: '/expensive' - fullPath: '/expensive' - preLoaderRoute: typeof ExpensiveIndexRouteImport - parentRoute: typeof rootRoute - } - '/dashboard/invoices/$invoiceId': { - id: '/dashboard/invoices/$invoiceId' - path: '/$invoiceId' - fullPath: '/dashboard/invoices/$invoiceId' - preLoaderRoute: typeof DashboardInvoicesInvoiceIdRouteImport - parentRoute: typeof DashboardInvoicesRouteRouteImport - } - '/dashboard/users/user': { - id: '/dashboard/users/user' - path: '/user' - fullPath: '/dashboard/users/user' - preLoaderRoute: typeof DashboardUsersUserRouteImport - parentRoute: typeof DashboardUsersRouteRouteImport - } - '/dashboard/invoices/': { - id: '/dashboard/invoices/' - path: '/' - fullPath: '/dashboard/invoices/' - preLoaderRoute: typeof DashboardInvoicesIndexRouteImport - parentRoute: typeof DashboardInvoicesRouteRouteImport - } - '/dashboard/users/': { - id: '/dashboard/users/' - path: '/' - fullPath: '/dashboard/users/' - preLoaderRoute: typeof DashboardUsersIndexRouteImport - parentRoute: typeof DashboardUsersRouteRouteImport - } - } -} - -// Create and export the route tree - -interface DashboardInvoicesRouteRouteChildren { - DashboardInvoicesInvoiceIdRoute: typeof DashboardInvoicesInvoiceIdRoute - DashboardInvoicesIndexRoute: typeof DashboardInvoicesIndexRoute -} - -const DashboardInvoicesRouteRouteChildren: DashboardInvoicesRouteRouteChildren = - { - DashboardInvoicesInvoiceIdRoute: DashboardInvoicesInvoiceIdRoute, - DashboardInvoicesIndexRoute: DashboardInvoicesIndexRoute, - } - -const DashboardInvoicesRouteRouteWithChildren = - DashboardInvoicesRouteRoute._addFileChildren( - DashboardInvoicesRouteRouteChildren, - ) - -interface DashboardUsersRouteRouteChildren { - DashboardUsersUserRoute: typeof DashboardUsersUserRoute - DashboardUsersIndexRoute: typeof DashboardUsersIndexRoute -} - -const DashboardUsersRouteRouteChildren: DashboardUsersRouteRouteChildren = { - DashboardUsersUserRoute: DashboardUsersUserRoute, - DashboardUsersIndexRoute: DashboardUsersIndexRoute, -} - -const DashboardUsersRouteRouteWithChildren = - DashboardUsersRouteRoute._addFileChildren(DashboardUsersRouteRouteChildren) - -interface DashboardRouteRouteChildren { - DashboardInvoicesRouteRoute: typeof DashboardInvoicesRouteRouteWithChildren - DashboardUsersRouteRoute: typeof DashboardUsersRouteRouteWithChildren - DashboardIndexRoute: typeof DashboardIndexRoute -} - -const DashboardRouteRouteChildren: DashboardRouteRouteChildren = { - DashboardInvoicesRouteRoute: DashboardInvoicesRouteRouteWithChildren, - DashboardUsersRouteRoute: DashboardUsersRouteRouteWithChildren, - DashboardIndexRoute: DashboardIndexRoute, -} - -const DashboardRouteRouteWithChildren = DashboardRouteRoute._addFileChildren( - DashboardRouteRouteChildren, -) - -interface AuthRouteChildren { - AuthProfileRoute: typeof AuthProfileRoute -} - -const AuthRouteChildren: AuthRouteChildren = { - AuthProfileRoute: AuthProfileRoute, -} - -const AuthRouteWithChildren = AuthRoute._addFileChildren(AuthRouteChildren) - -interface PathlessLayoutRouteChildren { - PathlessLayoutRouteARoute: typeof PathlessLayoutRouteARoute - PathlessLayoutRouteBRoute: typeof PathlessLayoutRouteBRoute -} - -const PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = { - PathlessLayoutRouteARoute: PathlessLayoutRouteARoute, - PathlessLayoutRouteBRoute: PathlessLayoutRouteBRoute, -} - -const PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren( - PathlessLayoutRouteChildren, -) - export interface FileRoutesByFullPath { '/': typeof IndexRoute '/dashboard': typeof DashboardRouteRouteWithChildren - '': typeof PathlessLayoutRouteWithChildren '/login': typeof LoginRoute '/dashboard/invoices': typeof DashboardInvoicesRouteRouteWithChildren '/dashboard/users': typeof DashboardUsersRouteRouteWithChildren @@ -348,10 +130,8 @@ export interface FileRoutesByFullPath { '/dashboard/invoices/': typeof DashboardInvoicesIndexRoute '/dashboard/users/': typeof DashboardUsersIndexRoute } - export interface FileRoutesByTo { '/': typeof IndexRoute - '': typeof PathlessLayoutRouteWithChildren '/login': typeof LoginRoute '/route-group': typeof thisFolderIsNotInTheUrlRouteGroupRoute '/profile': typeof AuthProfileRoute @@ -364,9 +144,8 @@ export interface FileRoutesByTo { '/dashboard/invoices': typeof DashboardInvoicesIndexRoute '/dashboard/users': typeof DashboardUsersIndexRoute } - export interface FileRoutesById { - __root__: typeof rootRoute + __root__: typeof rootRouteImport '/': typeof IndexRoute '/dashboard': typeof DashboardRouteRouteWithChildren '/_auth': typeof AuthRouteWithChildren @@ -385,13 +164,11 @@ export interface FileRoutesById { '/dashboard/invoices/': typeof DashboardInvoicesIndexRoute '/dashboard/users/': typeof DashboardUsersIndexRoute } - export interface FileRouteTypes { fileRoutesByFullPath: FileRoutesByFullPath fullPaths: | '/' | '/dashboard' - | '' | '/login' | '/dashboard/invoices' | '/dashboard/users' @@ -408,7 +185,6 @@ export interface FileRouteTypes { fileRoutesByTo: FileRoutesByTo to: | '/' - | '' | '/login' | '/route-group' | '/profile' @@ -441,7 +217,6 @@ export interface FileRouteTypes { | '/dashboard/users/' fileRoutesById: FileRoutesById } - export interface RootRouteChildren { IndexRoute: typeof IndexRoute DashboardRouteRoute: typeof DashboardRouteRouteWithChildren @@ -452,6 +227,199 @@ export interface RootRouteChildren { ExpensiveIndexRoute: typeof ExpensiveIndexRoute } +declare module '@tanstack/react-router' { + interface FileRoutesByPath { + '/login': { + id: '/login' + path: '/login' + fullPath: '/login' + preLoaderRoute: typeof LoginRouteImport + parentRoute: typeof rootRouteImport + } + '/_pathlessLayout': { + id: '/_pathlessLayout' + path: '' + fullPath: '' + preLoaderRoute: typeof PathlessLayoutRouteImport + parentRoute: typeof rootRouteImport + } + '/_auth': { + id: '/_auth' + path: '' + fullPath: '' + preLoaderRoute: typeof AuthRouteImport + parentRoute: typeof rootRouteImport + } + '/dashboard': { + id: '/dashboard' + path: '/dashboard' + fullPath: '/dashboard' + preLoaderRoute: typeof DashboardRouteRouteImport + parentRoute: typeof rootRouteImport + } + '/': { + id: '/' + path: '/' + fullPath: '/' + preLoaderRoute: typeof IndexRouteImport + parentRoute: typeof rootRouteImport + } + '/expensive/': { + id: '/expensive/' + path: '/expensive' + fullPath: '/expensive' + preLoaderRoute: typeof ExpensiveIndexRouteImport + parentRoute: typeof rootRouteImport + } + '/dashboard/': { + id: '/dashboard/' + path: '/' + fullPath: '/dashboard/' + preLoaderRoute: typeof DashboardIndexRouteImport + parentRoute: typeof DashboardRouteRoute + } + '/_pathlessLayout/route-b': { + id: '/_pathlessLayout/route-b' + path: '/route-b' + fullPath: '/route-b' + preLoaderRoute: typeof PathlessLayoutRouteBRouteImport + parentRoute: typeof PathlessLayoutRoute + } + '/_pathlessLayout/route-a': { + id: '/_pathlessLayout/route-a' + path: '/route-a' + fullPath: '/route-a' + preLoaderRoute: typeof PathlessLayoutRouteARouteImport + parentRoute: typeof PathlessLayoutRoute + } + '/_auth/profile': { + id: '/_auth/profile' + path: '/profile' + fullPath: '/profile' + preLoaderRoute: typeof AuthProfileRouteImport + parentRoute: typeof AuthRoute + } + '/(this-folder-is-not-in-the-url)/route-group': { + id: '/(this-folder-is-not-in-the-url)/route-group' + path: '/route-group' + fullPath: '/route-group' + preLoaderRoute: typeof thisFolderIsNotInTheUrlRouteGroupRouteImport + parentRoute: typeof rootRouteImport + } + '/dashboard/users': { + id: '/dashboard/users' + path: '/users' + fullPath: '/dashboard/users' + preLoaderRoute: typeof DashboardUsersRouteRouteImport + parentRoute: typeof DashboardRouteRoute + } + '/dashboard/invoices': { + id: '/dashboard/invoices' + path: '/invoices' + fullPath: '/dashboard/invoices' + preLoaderRoute: typeof DashboardInvoicesRouteRouteImport + parentRoute: typeof DashboardRouteRoute + } + '/dashboard/users/': { + id: '/dashboard/users/' + path: '/' + fullPath: '/dashboard/users/' + preLoaderRoute: typeof DashboardUsersIndexRouteImport + parentRoute: typeof DashboardUsersRouteRoute + } + '/dashboard/invoices/': { + id: '/dashboard/invoices/' + path: '/' + fullPath: '/dashboard/invoices/' + preLoaderRoute: typeof DashboardInvoicesIndexRouteImport + parentRoute: typeof DashboardInvoicesRouteRoute + } + '/dashboard/users/user': { + id: '/dashboard/users/user' + path: '/user' + fullPath: '/dashboard/users/user' + preLoaderRoute: typeof DashboardUsersUserRouteImport + parentRoute: typeof DashboardUsersRouteRoute + } + '/dashboard/invoices/$invoiceId': { + id: '/dashboard/invoices/$invoiceId' + path: '/$invoiceId' + fullPath: '/dashboard/invoices/$invoiceId' + preLoaderRoute: typeof DashboardInvoicesInvoiceIdRouteImport + parentRoute: typeof DashboardInvoicesRouteRoute + } + } +} + +interface DashboardInvoicesRouteRouteChildren { + DashboardInvoicesInvoiceIdRoute: typeof DashboardInvoicesInvoiceIdRoute + DashboardInvoicesIndexRoute: typeof DashboardInvoicesIndexRoute +} + +const DashboardInvoicesRouteRouteChildren: DashboardInvoicesRouteRouteChildren = + { + DashboardInvoicesInvoiceIdRoute: DashboardInvoicesInvoiceIdRoute, + DashboardInvoicesIndexRoute: DashboardInvoicesIndexRoute, + } + +const DashboardInvoicesRouteRouteWithChildren = + DashboardInvoicesRouteRoute._addFileChildren( + DashboardInvoicesRouteRouteChildren, + ) + +interface DashboardUsersRouteRouteChildren { + DashboardUsersUserRoute: typeof DashboardUsersUserRoute + DashboardUsersIndexRoute: typeof DashboardUsersIndexRoute +} + +const DashboardUsersRouteRouteChildren: DashboardUsersRouteRouteChildren = { + DashboardUsersUserRoute: DashboardUsersUserRoute, + DashboardUsersIndexRoute: DashboardUsersIndexRoute, +} + +const DashboardUsersRouteRouteWithChildren = + DashboardUsersRouteRoute._addFileChildren(DashboardUsersRouteRouteChildren) + +interface DashboardRouteRouteChildren { + DashboardInvoicesRouteRoute: typeof DashboardInvoicesRouteRouteWithChildren + DashboardUsersRouteRoute: typeof DashboardUsersRouteRouteWithChildren + DashboardIndexRoute: typeof DashboardIndexRoute +} + +const DashboardRouteRouteChildren: DashboardRouteRouteChildren = { + DashboardInvoicesRouteRoute: DashboardInvoicesRouteRouteWithChildren, + DashboardUsersRouteRoute: DashboardUsersRouteRouteWithChildren, + DashboardIndexRoute: DashboardIndexRoute, +} + +const DashboardRouteRouteWithChildren = DashboardRouteRoute._addFileChildren( + DashboardRouteRouteChildren, +) + +interface AuthRouteChildren { + AuthProfileRoute: typeof AuthProfileRoute +} + +const AuthRouteChildren: AuthRouteChildren = { + AuthProfileRoute: AuthProfileRoute, +} + +const AuthRouteWithChildren = AuthRoute._addFileChildren(AuthRouteChildren) + +interface PathlessLayoutRouteChildren { + PathlessLayoutRouteARoute: typeof PathlessLayoutRouteARoute + PathlessLayoutRouteBRoute: typeof PathlessLayoutRouteBRoute +} + +const PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = { + PathlessLayoutRouteARoute: PathlessLayoutRouteARoute, + PathlessLayoutRouteBRoute: PathlessLayoutRouteBRoute, +} + +const PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren( + PathlessLayoutRouteChildren, +) + const rootRouteChildren: RootRouteChildren = { IndexRoute: IndexRoute, DashboardRouteRoute: DashboardRouteRouteWithChildren, @@ -462,107 +430,6 @@ const rootRouteChildren: RootRouteChildren = { thisFolderIsNotInTheUrlRouteGroupRoute, ExpensiveIndexRoute: ExpensiveIndexRoute, } - -export const routeTree = rootRoute +export const routeTree = rootRouteImport ._addFileChildren(rootRouteChildren) ._addFileTypes() - -/* ROUTE_MANIFEST_START -{ - "routes": { - "__root__": { - "filePath": "__root.tsx", - "children": [ - "/", - "/dashboard", - "/_auth", - "/_pathlessLayout", - "/login", - "/(this-folder-is-not-in-the-url)/route-group", - "/expensive/" - ] - }, - "/": { - "filePath": "index.tsx" - }, - "/dashboard": { - "filePath": "dashboard.route.tsx", - "children": [ - "/dashboard/invoices", - "/dashboard/users", - "/dashboard/" - ] - }, - "/_auth": { - "filePath": "_auth.tsx", - "children": [ - "/_auth/profile" - ] - }, - "/_pathlessLayout": { - "filePath": "_pathlessLayout.tsx", - "children": [ - "/_pathlessLayout/route-a", - "/_pathlessLayout/route-b" - ] - }, - "/login": { - "filePath": "login.tsx" - }, - "/dashboard/invoices": { - "filePath": "dashboard.invoices.route.tsx", - "parent": "/dashboard", - "children": [ - "/dashboard/invoices/$invoiceId", - "/dashboard/invoices/" - ] - }, - "/dashboard/users": { - "filePath": "dashboard.users.route.tsx", - "parent": "/dashboard", - "children": [ - "/dashboard/users/user", - "/dashboard/users/" - ] - }, - "/(this-folder-is-not-in-the-url)/route-group": { - "filePath": "(this-folder-is-not-in-the-url)/route-group.tsx" - }, - "/_auth/profile": { - "filePath": "_auth.profile.tsx", - "parent": "/_auth" - }, - "/_pathlessLayout/route-a": { - "filePath": "_pathlessLayout.route-a.tsx", - "parent": "/_pathlessLayout" - }, - "/_pathlessLayout/route-b": { - "filePath": "_pathlessLayout.route-b.tsx", - "parent": "/_pathlessLayout" - }, - "/dashboard/": { - "filePath": "dashboard.index.tsx", - "parent": "/dashboard" - }, - "/expensive/": { - "filePath": "expensive/index.tsx" - }, - "/dashboard/invoices/$invoiceId": { - "filePath": "dashboard.invoices.$invoiceId.tsx", - "parent": "/dashboard/invoices" - }, - "/dashboard/users/user": { - "filePath": "dashboard.users.user.tsx", - "parent": "/dashboard/users" - }, - "/dashboard/invoices/": { - "filePath": "dashboard.invoices.index.tsx", - "parent": "/dashboard/invoices" - }, - "/dashboard/users/": { - "filePath": "dashboard.users.index.tsx", - "parent": "/dashboard/users" - } - } -} -ROUTE_MANIFEST_END */ diff --git a/examples/react/kitchen-sink-file-based/src/routes/login.tsx b/examples/react/kitchen-sink-file-based/src/routes/login.tsx index d7833bae234..b60c46de31d 100644 --- a/examples/react/kitchen-sink-file-based/src/routes/login.tsx +++ b/examples/react/kitchen-sink-file-based/src/routes/login.tsx @@ -7,7 +7,6 @@ export const Route = createFileRoute('/login')({ validateSearch: z.object({ redirect: z.string().optional(), }), -}).update({ component: LoginComponent, }) diff --git a/examples/react/start-clerk-basic/src/routeTree.gen.ts b/examples/react/start-clerk-basic/src/routeTree.gen.ts index 411606473c5..baaabbc2c03 100644 --- a/examples/react/start-clerk-basic/src/routeTree.gen.ts +++ b/examples/react/start-clerk-basic/src/routeTree.gen.ts @@ -171,9 +171,11 @@ export const routeTree = rootRouteImport ._addFileTypes() import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' +import type { startInstance } from './start.ts' declare module '@tanstack/react-start' { interface Register { + ssr: true router: Awaited> + config: Awaited> } } diff --git a/examples/solid/kitchen-sink-file-based/src/routes/login.tsx b/examples/solid/kitchen-sink-file-based/src/routes/login.tsx index 7b403ae66f3..9acacb4248e 100644 --- a/examples/solid/kitchen-sink-file-based/src/routes/login.tsx +++ b/examples/solid/kitchen-sink-file-based/src/routes/login.tsx @@ -7,7 +7,6 @@ export const Route = createFileRoute('/login')({ validateSearch: z.object({ redirect: z.string().optional(), }), -}).update({ component: LoginComponent, })