import { NavigateOptions } from './link.js'; import { RoutePaths } from './routeInfo.js'; import { AnyRouter, RegisteredRouter } from './router.js'; import { PickAsRequired } from './utils.js'; export type AnyRedirect = Redirect; /** * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType) */ export type Redirect | string = '/', TTo extends string | undefined = '.', TMaskFrom extends RoutePaths | string = TFrom, TMaskTo extends string = '.'> = { href?: string; /** * @deprecated Use `statusCode` instead **/ code?: number; /** * The HTTP status code to use when redirecting. * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType#statuscode-property) */ statusCode?: number; /** * If provided, will throw the redirect object instead of returning it. This can be useful in places where `throwing` in a function might cause it to have a return type of `never`. In that case, you can use `redirect({ throw: true })` to throw the redirect object instead of returning it. * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType#throw-property) */ throw?: any; /** * The HTTP headers to use when redirecting. * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType#headers-property) */ headers?: HeadersInit; } & NavigateOptions; export type ResolvedRedirect = '/', TTo extends string = '', TMaskFrom extends RoutePaths = TFrom, TMaskTo extends string = ''> = PickAsRequired, 'code' | 'statusCode' | 'headers'> & { href: string; }; export declare function redirect(opts: Redirect): Redirect; export declare function isRedirect(obj: any): obj is AnyRedirect; export declare function isResolvedRedirect(obj: any): obj is ResolvedRedirect;