diff --git a/packages/router-core/src/router.ts b/packages/router-core/src/router.ts index 065bc7bffa..94532b2b4a 100644 --- a/packages/router-core/src/router.ts +++ b/packages/router-core/src/router.ts @@ -46,6 +46,7 @@ import type { } from '@tanstack/history' import type { Awaitable, + Constrain, ControlledPromise, NoInfer, NonNullableUpdater, @@ -84,7 +85,10 @@ import type { Manifest } from './manifest' import type { AnySchema, AnyValidator } from './validators' import type { NavigateOptions, ResolveRelativePath, ToOptions } from './link' import type { NotFoundError } from './not-found' -import type { AnySerializationAdapter } from './ssr/serializer/transformer' +import type { + AnySerializationAdapter, + ValidateSerializableInput, +} from './ssr/serializer/transformer' import type { AnyRouterConfig } from './config' export type ControllablePromise = Promise & { @@ -122,7 +126,7 @@ export interface RouterOptions< TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean = false, TRouterHistory extends RouterHistory = RouterHistory, - TDehydrated extends Record = Record, + TDehydrated = undefined, > extends RouterOptionsExtensions { /** * The history object that will be used to manage the browser history. @@ -290,7 +294,10 @@ export interface RouterOptions< * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#dehydrate-method) * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/external-data-loading#critical-dehydrationhydration) */ - dehydrate?: () => Awaitable + dehydrate?: () => Constrain< + TDehydrated, + ValidateSerializableInput + > /** * A function that will be called when the router is hydrated. *