@tanstack/react-router 0.0.1-beta.256 → 0.0.1-beta.258
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/redirects.js +3 -0
- package/build/cjs/redirects.js.map +1 -1
- package/build/cjs/route.js +1 -1
- package/build/cjs/route.js.map +1 -1
- package/build/esm/index.js +4 -1
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +355 -355
- package/build/types/redirects.d.ts +4 -3
- package/build/umd/index.development.js +4 -1
- 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/redirects.ts +11 -3
- package/src/route.ts +1 -1
|
@@ -3,8 +3,9 @@ import { AnyRoute } from './route';
|
|
|
3
3
|
import { RoutePaths } from './routeInfo';
|
|
4
4
|
import { RegisteredRouter } from './router';
|
|
5
5
|
export type AnyRedirect = Redirect<any, any, any>;
|
|
6
|
-
export type Redirect<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = TFrom, TMaskTo extends string = ''> =
|
|
6
|
+
export type Redirect<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = TFrom, TMaskTo extends string = ''> = {
|
|
7
7
|
code?: number;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
throw?: any;
|
|
9
|
+
} & NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>;
|
|
10
|
+
export declare function redirect<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouteTree> = TFrom, TMaskTo extends string = ''>(opts: Redirect<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>): Redirect<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>;
|
|
10
11
|
export declare function isRedirect(obj: any): obj is AnyRedirect;
|
|
@@ -1132,7 +1132,7 @@
|
|
|
1132
1132
|
constructor(options) {
|
|
1133
1133
|
this.options = options || {};
|
|
1134
1134
|
this.isRoot = !options?.getParentRoute;
|
|
1135
|
-
invariant(!(options
|
|
1135
|
+
invariant(!(options?.id && options?.path), `Route cannot have both an 'id' and a 'path' option.`);
|
|
1136
1136
|
this.$$typeof = Symbol.for('react.memo');
|
|
1137
1137
|
}
|
|
1138
1138
|
init = opts => {
|
|
@@ -1797,6 +1797,9 @@
|
|
|
1797
1797
|
|
|
1798
1798
|
function redirect(opts) {
|
|
1799
1799
|
opts.isRedirect = true;
|
|
1800
|
+
if (opts.throw) {
|
|
1801
|
+
throw opts;
|
|
1802
|
+
}
|
|
1800
1803
|
return opts;
|
|
1801
1804
|
}
|
|
1802
1805
|
function isRedirect(obj) {
|