UNPKG

react-router-magic

Version:
28 lines (27 loc) 1.82 kB
/// <reference types="react" /> import { RouterStoreState } from './Store'; import { MouseEvent } from 'react'; import { LocationDescriptorObject, History, Location } from 'history'; export declare type Match = null | undefined | boolean | object; export declare type ValOrFunc<Result> = Result | ((location: Location, parentMatch: Match) => Result); export declare type NavParams = { href: string; match: Match; location: Location; navigate: () => void; handleAnchorClick: (event: MouseEvent<any>) => void; }; export declare type StringOrLocationDescriptorObject = string | LocationDescriptorObject; export declare type ToProps = (StringOrLocationDescriptorObject | ((currentMatch: Match, location: Location, parentMatch: Match) => StringOrLocationDescriptorObject)); export declare function execValOrFunc<Val>(valOrFunc: ValOrFunc<Val>, location: Location, parentMatch: Match): Val; export declare function checkSwitchState(props: { switchIndex?: number | false; }, parentRouterState: RouterStoreState, match: Match): Match; export declare function isModifiedEvent(event: MouseEvent<any>): boolean; export declare function createNavParams(to: ToProps, history: History, location: Location, replace?: boolean, match?: ValOrFunc<Match>, parentMatch?: Match): NavParams; export declare function createHandleAnchorClick(navigate: () => void): (event: MouseEvent<any>, target?: string) => void; export declare function navigate(to: LocationDescriptorObject, history: History, replace?: boolean): void; export declare function execTo(to: ToProps, match: Match, location: Location, parentMatch?: Match): LocationDescriptorObject; export declare function hoistNonReactStatics(targetComponent: any, sourceComponent: any, customStatics?: { [key: string]: boolean; }): any;