dew-router
Version:
34 lines (33 loc) • 950 B
TypeScript
import { WebsiteRoute } from 'dew-types';
import { MatchFunction, PathFunction } from 'path-to-regexp';
import { ReactNode } from 'react';
export interface RouterNavigator {
pushState: History['pushState'];
navigate: (to: string) => void;
}
export declare type UrlQuery = Record<string, StringOrStringArray>;
export declare type UrlParams = Record<string, StringOrStringArray>;
export interface RouterLocation {
pathname: string;
search: string;
}
export declare type StringOrStringArray = string | string[];
export interface MatchedRoute extends WebsiteRoute {
path: string;
params: UrlParams;
matcher: MatchFunction<UrlParams>;
pathFn: PathFunction<UrlParams>;
}
export interface LinkValue {
name: string;
lang: string;
params?: UrlParams;
query?: UrlQuery;
}
export interface RouteContextValue {
path: string;
}
export interface RouteProviderProps {
path: string;
children: ReactNode;
}