@tanstack/react-router 0.0.1-beta.284 → 0.0.1-beta.286

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.
@@ -43,7 +43,7 @@ export type ToSubOptions<TRouteTree extends AnyRoute = RegisteredRouter['routeTr
43
43
  state?: true | NonNullableUpdater<HistoryState>;
44
44
  from?: TFrom;
45
45
  } & CheckPath<TRouteTree, NoInfer<TResolved>, {}> & SearchParamOptions<TRouteTree, TFrom, TTo, TResolved> & PathParamOptions<TRouteTree, TFrom, TResolved>;
46
- export type SearchParamOptions<TRouteTree extends AnyRoute, TFrom, TTo, TResolved = ResolveRelativePath<TFrom, NoInfer<TTo>>, TFromSearchEnsured = '/' extends TFrom ? FullSearchSchema<TRouteTree> : Expand<UnionToIntersection<PickRequired<RouteByPath<TRouteTree, TFrom>['types']['fullSearchSchema']>>>, TFromSearchOptional = Omit<FullSearchSchema<TRouteTree>, keyof TFromSearchEnsured>, TFromSearch = Expand<TFromSearchEnsured & TFromSearchOptional>, TToSearch = '' extends TTo ? FullSearchSchema<TRouteTree> : Expand<RouteByPath<TRouteTree, TResolved>['types']['fullSearchSchema']>> = keyof PickRequired<TToSearch> extends never ? {
46
+ export type SearchParamOptions<TRouteTree extends AnyRoute, TFrom, TTo, TResolved = ResolveRelativePath<TFrom, NoInfer<TTo>>, TFromSearchEnsured = '/' extends TFrom ? FullSearchSchema<TRouteTree> : Expand<PickRequired<RouteByPath<TRouteTree, TFrom>['types']['fullSearchSchema']>>, TFromSearchOptional = Omit<FullSearchSchema<TRouteTree>, keyof TFromSearchEnsured>, TFromSearch = Expand<TFromSearchEnsured & TFromSearchOptional>, TToSearch = '' extends TTo ? FullSearchSchema<TRouteTree> : Expand<RouteByPath<TRouteTree, TResolved>['types']['fullSearchSchema']>> = keyof PickRequired<TToSearch> extends never ? {
47
47
  search?: true | SearchReducer<TFromSearch, TToSearch>;
48
48
  } : {
49
49
  search: TFromSearchEnsured extends PickRequired<TToSearch> ? true | SearchReducer<TFromSearch, TToSearch> : SearchReducer<TFromSearch, TToSearch>;
@@ -1,5 +1,5 @@
1
1
  import { AnyRoute, Route } from './route';
2
- import { Expand, UnionToIntersection } from './utils';
2
+ import { Expand, UnionToIntersection, UnionToTuple } from './utils';
3
3
  export type ParseRoute<TRouteTree extends AnyRoute> = TRouteTree | ParseRouteChildren<TRouteTree>;
4
4
  export type ParseRouteChildren<TRouteTree extends AnyRoute> = TRouteTree extends Route<any, any, any, any, any, any, any, any, any, any, any, any, any, any, infer TChildren, any> ? unknown extends TChildren ? never : TChildren extends AnyRoute[] ? {
5
5
  [TId in TChildren[number]['id'] as string]: ParseRoute<TChildren[number]>;
@@ -18,5 +18,14 @@ export type RouteByPath<TRouteTree extends AnyRoute, TPath> = Extract<ParseRoute
18
18
  fullPath: TPath;
19
19
  }>;
20
20
  export type RoutePaths<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree>['fullPath'] | '/';
21
- export type FullSearchSchema<TRouteTree extends AnyRoute> = Partial<Expand<UnionToIntersection<ParseRoute<TRouteTree>['types']['fullSearchSchema']>>>;
21
+ type UnionizeCollisions<T, U> = {
22
+ [P in keyof T & keyof U]: T[P] extends U[P] ? T[P] : T[P] | U[P];
23
+ };
24
+ type Reducer<T, U, C = UnionizeCollisions<T, U>> = C & Omit<T, keyof C> & Omit<U, keyof C>;
25
+ type Reduce<T extends any[], Result = unknown> = T extends [
26
+ infer First,
27
+ ...infer Rest
28
+ ] ? Reduce<Rest, Reducer<Result, First>> : Result;
29
+ export type FullSearchSchema<TRouteTree extends AnyRoute> = Partial<Expand<Reduce<UnionToTuple<ParseRoute<TRouteTree>['types']['fullSearchSchema']>>>>;
22
30
  export type AllParams<TRouteTree extends AnyRoute> = Expand<UnionToIntersection<ParseRoute<TRouteTree>['types']['allParams']>>;
31
+ export {};
@@ -36,6 +36,8 @@ export type PickExtract<T, U> = {
36
36
  export type PickExclude<T, U> = {
37
37
  [K in keyof T as T[K] extends U ? never : K]: T[K];
38
38
  };
39
+ type LastInUnion<U> = UnionToIntersection<U extends unknown ? (x: U) => 0 : never> extends (x: infer L) => 0 ? L : never;
40
+ export type UnionToTuple<U, Last = LastInUnion<U>> = [U] extends [never] ? [] : [...UnionToTuple<Exclude<U, Last>>, Last];
39
41
  export declare const isServer: boolean;
40
42
  export declare function last<T>(arr: T[]): T | undefined;
41
43
  export declare function functionalUpdate<TResult>(updater: Updater<TResult> | NonNullableUpdater<TResult>, previous: TResult): TResult;
@@ -64,3 +66,4 @@ export declare function useRouteContext<TRouteTree extends AnyRoute = Registered
64
66
  }): TStrict extends true ? TSelected : TSelected | undefined;
65
67
  export declare const useLayoutEffect: typeof React.useLayoutEffect;
66
68
  export declare function escapeJSON(jsonString: string): string;
69
+ export {};