@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.
- package/build/cjs/Matches.js +11 -3
- package/build/cjs/Matches.js.map +1 -1
- package/build/cjs/link.js.map +1 -1
- package/build/cjs/utils.js +2 -0
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.js +533 -524
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +432 -426
- package/build/types/link.d.ts +1 -1
- package/build/types/routeInfo.d.ts +11 -2
- package/build/types/utils.d.ts +3 -0
- package/build/umd/index.development.js +533 -524
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/Matches.tsx +18 -5
- package/src/link.tsx +0 -2
- package/src/routeInfo.ts +16 -2
- package/src/utils.ts +10 -0
package/build/types/link.d.ts
CHANGED
|
@@ -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<
|
|
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
|
-
|
|
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 {};
|
package/build/types/utils.d.ts
CHANGED
|
@@ -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 {};
|