@tanstack/router-core 0.0.1-beta.172 → 0.0.1-beta.174

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.
@@ -151,12 +151,12 @@ type HydrationCtx = {
151
151
  router: DehydratedRouter;
152
152
  payload: Record<string, any>;
153
153
  };
154
- interface RouteMatch<TRouteTree extends AnyRoute = AnyRoute, TRoute extends AnyRoute = AnyRoute> {
154
+ interface RouteMatch<TRouteTree extends AnyRoute = AnyRoute, TRouteId extends RouteIds<TRouteTree> = ParseRoute<TRouteTree>['id']> {
155
155
  id: string;
156
156
  key?: string;
157
- routeId: string;
157
+ routeId: TRouteId;
158
158
  pathname: string;
159
- params: TRoute['types']['allParams'];
159
+ params: RouteById<TRouteTree, TRouteId>['types']['allParams'];
160
160
  status: 'pending' | 'success' | 'error';
161
161
  isFetching: boolean;
162
162
  invalid: boolean;
@@ -166,17 +166,17 @@ interface RouteMatch<TRouteTree extends AnyRoute = AnyRoute, TRoute extends AnyR
166
166
  updatedAt: number;
167
167
  invalidAt: number;
168
168
  preloadInvalidAt: number;
169
- loaderData: TRoute['types']['loader'];
169
+ loaderData: RouteById<TRouteTree, TRouteId>['types']['loader'];
170
170
  loadPromise?: Promise<void>;
171
171
  __resolveLoadPromise?: () => void;
172
- routeContext: TRoute['types']['routeContext'];
173
- context: TRoute['types']['context'];
174
- routeSearch: TRoute['types']['searchSchema'];
175
- search: FullSearchSchema<TRouteTree> & TRoute['types']['fullSearchSchema'];
172
+ routeContext: RouteById<TRouteTree, TRouteId>['types']['routeContext'];
173
+ context: RouteById<TRouteTree, TRouteId>['types']['context'];
174
+ routeSearch: RouteById<TRouteTree, TRouteId>['types']['searchSchema'];
175
+ search: FullSearchSchema<TRouteTree> & RouteById<TRouteTree, TRouteId>['types']['fullSearchSchema'];
176
176
  fetchedAt: number;
177
177
  abortController: AbortController;
178
178
  }
179
- type AnyRouteMatch = RouteMatch<AnyRoute, AnyRoute>;
179
+ type AnyRouteMatch = RouteMatch<any>;
180
180
  type RouterContextOptions<TRouteTree extends AnyRoute> = AnyContext extends TRouteTree['types']['routerContext'] ? {
181
181
  context?: TRouteTree['types']['routerContext'];
182
182
  } : {
@@ -212,11 +212,11 @@ interface RouterOptions<TRouteTree extends AnyRoute, TDehydrated extends Record<
212
212
  interface RouterState<TRouteTree extends AnyRoute = AnyRoute> {
213
213
  status: 'idle' | 'pending';
214
214
  isFetching: boolean;
215
- matchesById: Record<string, RouteMatch<TRouteTree, ParseRoute<TRouteTree>>>;
215
+ matchesById: Record<string, RouteMatch<TRouteTree>>;
216
216
  matchIds: string[];
217
217
  pendingMatchIds: string[];
218
- matches: RouteMatch<TRouteTree, ParseRoute<TRouteTree>>[];
219
- pendingMatches: RouteMatch<TRouteTree, ParseRoute<TRouteTree>>[];
218
+ matches: RouteMatch<TRouteTree>[];
219
+ pendingMatches: RouteMatch<TRouteTree>[];
220
220
  location: ParsedLocation<FullSearchSchema<TRouteTree>>;
221
221
  resolvedLocation: ParsedLocation<FullSearchSchema<TRouteTree>>;
222
222
  lastUpdated: number;
@@ -314,12 +314,12 @@ declare class Router<TRouteTree extends AnyRoute = AnyRoute, TDehydrated extends
314
314
  getRoute: (id: string) => Route;
315
315
  preloadRoute: (navigateOpts?: BuildNextOptions & {
316
316
  maxAge?: number;
317
- }) => Promise<RouteMatch<TRouteTree, ParseRoute<TRouteTree>>[]>;
317
+ }) => Promise<RouteMatch<TRouteTree, ParseRoute<TRouteTree>["id"]>[]>;
318
318
  cleanMatches: () => void;
319
319
  matchRoutes: (pathname: string, locationSearch: AnySearchSchema, opts?: {
320
320
  throwOnError?: boolean;
321
321
  debug?: boolean;
322
- }) => RouteMatch<TRouteTree, ParseRoute<TRouteTree>>[];
322
+ }) => RouteMatch<TRouteTree>[];
323
323
  loadMatches: (resolvedMatches: AnyRouteMatch[], opts?: {
324
324
  preload?: boolean;
325
325
  maxAge?: number;
@@ -335,8 +335,8 @@ declare class Router<TRouteTree extends AnyRoute = AnyRoute, TDehydrated extends
335
335
  injectHtml: (html: string | (() => Promise<string> | string)) => Promise<void>;
336
336
  dehydrateData: <T>(key: any, getData: T | (() => T | Promise<T>)) => () => T | undefined;
337
337
  hydrateData: <T = unknown>(key: any) => T | undefined;
338
- getRouteMatch: (id: string) => undefined | RouteMatch<TRouteTree, AnyRoute>;
339
- setRouteMatch: (id: string, updater: (prev: RouteMatch<TRouteTree, AnyRoute>) => RouteMatch<TRouteTree, AnyRoute>) => void;
338
+ getRouteMatch: (id: string) => undefined | RouteMatch<TRouteTree>;
339
+ setRouteMatch: (id: string, updater: (prev: RouteMatch<TRouteTree>) => RouteMatch<TRouteTree>) => void;
340
340
  setRouteMatchData: (id: string, updater: (prev: any) => any, opts?: {
341
341
  updatedAt?: number;
342
342
  maxAge?: number;