/// import { BrowserHistoryBuildOptions } from 'history'; import { PreloadedQuery } from 'react-relay/lib/relay-experimental/EntryPointTypes'; import { match } from 'react-router'; import { Resource } from './JSResource'; import { Router } from './RoutingContext'; export interface RouteConfig { key?: React.Key; location?: Location; path?: string | string[]; exact?: boolean; strict?: boolean; component: Resource; prepare: (params: { [key: string]: string; }) => { [queryName: string]: PreloadedQuery; }; routes?: RouteConfig[]; } export interface MatchedRoute { route: RouteConfig; match: match; } /** * A custom router built from the same primitives as react-router. Each object in `routes` * contains both a Component and a prepare() function that can preload data for the component. * The router watches for changes to the current location via the `history` package, maps the * location to the corresponding route entry, and then preloads the code and data for the route. */ export default function createRouter(routes: RouteConfig[], options?: BrowserHistoryBuildOptions): { cleanup: import("history").UnregisterCallback; context: Router; };