@tanstack/react-router 0.0.1-beta.275 → 0.0.1-beta.276

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ import { NavigateOptions, ResolveRelativePath, ToOptions } from './link';
3
3
  import { ParsedLocation } from './location';
4
4
  import { AnyRoute } from './route';
5
5
  import { RouteById, RoutePaths } from './routeInfo';
6
- import { BuildNextOptions, RegisteredRouter, Router, RouterOptions, RouterState } from './router';
6
+ import { RegisteredRouter, Router, RouterOptions, RouterState } from './router';
7
7
  import { NoInfer } from './utils';
8
8
  import { MatchRouteOptions } from './Matches';
9
9
  import { RouteMatch } from './Matches';
@@ -20,7 +20,7 @@ export interface MatchLocation {
20
20
  }
21
21
  export type NavigateFn<TRouteTree extends AnyRoute> = <TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = TFrom, TMaskTo extends string = ''>(opts: NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>) => Promise<void>;
22
22
  export type MatchRouteFn<TRouteTree extends AnyRoute> = <TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TResolved = ResolveRelativePath<TFrom, NoInfer<TTo>>>(location: ToOptions<TRouteTree, TFrom, TTo>, opts?: MatchRouteOptions) => false | RouteById<TRouteTree, TResolved>['types']['allParams'];
23
- export type BuildLocationFn<TRouteTree extends AnyRoute> = (opts: BuildNextOptions) => ParsedLocation;
23
+ export type BuildLocationFn<TRouteTree extends AnyRoute> = (opts: ToOptions<TRouteTree>) => ParsedLocation;
24
24
  export type InjectedHtmlEntry = string | (() => Promise<string> | string);
25
25
  export declare let routerContext: React.Context<Router<any, Record<string, any>>>;
26
26
  export declare function RouterProvider<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TDehydrated extends Record<string, any> = Record<string, any>>({ router, ...rest }: RouterProps<TRouteTree, TDehydrated>): React.JSX.Element;
@@ -59,7 +59,7 @@ type BeforeLoadFn<TFullSearchSchema extends Record<string, any>, TParentRoute ex
59
59
  context: TParentRoute['types']['allContext'];
60
60
  location: ParsedLocation;
61
61
  navigate: NavigateFn<AnyRoute>;
62
- buildLocation: BuildLocationFn<AnyRoute>;
62
+ buildLocation: BuildLocationFn<TParentRoute>;
63
63
  cause: 'preload' | 'enter' | 'stay';
64
64
  }) => Promise<TRouteContext> | TRouteContext | void;
65
65
  export type UpdatableRouteOptions<TFullSearchSchema extends Record<string, any>> = MetaOptions & {
@@ -9,6 +9,7 @@ import { AnyRouteMatch, RouteMatch } from './Matches';
9
9
  import { ParsedLocation } from './location';
10
10
  import { SearchSerializer, SearchParser } from './searchParams';
11
11
  import { BuildLocationFn, CommitLocationOptions, InjectedHtmlEntry, MatchRouteFn, NavigateFn } from './RouterProvider';
12
+ import { ToOptions } from './link';
12
13
  declare global {
13
14
  interface Window {
14
15
  __TSR_DEHYDRATED__?: HydrationCtx;
@@ -169,7 +170,7 @@ export declare class Router<TRouteTree extends AnyRoute = AnyRoute, TDehydrated
169
170
  load: (opts?: {
170
171
  invalidate?: boolean;
171
172
  }) => Promise<void>;
172
- preloadRoute: (navigateOpts?: BuildNextOptions) => Promise<RouteMatch<AnyRoute, any>[]>;
173
+ preloadRoute: (navigateOpts?: ToOptions<TRouteTree>) => Promise<RouteMatch<AnyRoute, any>[]>;
173
174
  matchRoute: MatchRouteFn<TRouteTree>;
174
175
  injectHtml: (html: string | (() => Promise<string> | string)) => Promise<void>;
175
176
  dehydrateData: <T>(key: any, getData: T | (() => T | Promise<T>)) => () => T | undefined;