import React from 'react' import { History, Location } from 'history' import { match } from 'react-router' import { PreloadedQuery } from 'react-relay/lib/relay-experimental/EntryPointTypes' import { Resource } from './JSResource' export type PreparedQuery = { [queryName: string]: PreloadedQuery } export interface Route { location: Location entries: Entry[] } export type GenericRouteComponent = React.FC export interface Entry { component?: Resource prepared: PreparedQuery routeData: match<{}> } export interface Router { history: History get: () => Route preloadCode: (pathname: string) => void preload: (pathname: string) => void subscribe: (callback: (arg: Route) => void) => () => void } const RoutingContext = React.createContext(null) /** * A custom context instance for our router type */ export default RoutingContext