// 为了兼容 v5、v6 两个版本的路由 import 'react-router' /** * The pathname, search, and hash values of a URL. */ export interface Path { /** * A URL pathname, beginning with a /. * * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.pathname */ pathname: Pathname /** * A URL search string, beginning with a ?. * * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.search */ search: Search /** * A URL fragment identifier, beginning with a #. * * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.hash */ hash: Hash } /** * Describes a location that is the destination of some navigation, either via * `history.push` or `history.replace`. May be either a URL or the pieces of a * URL path. */ export type To = string | Partial export interface NavigateOptions { replace?: boolean state?: any } export interface NavigateFunction { (to: To, options?: NavigateOptions): void (delta: number): void } declare module 'react-router' { export function useNavigate(): NavigateFunction }