mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-04-04 20:54:36 +00:00
An `innerRef` prop was added to <Link> in `react-router-dom@4.2` The node will be an anchor tag, which is why I made the callback accept an `HTMLAnchorElement` rather than an `HTMLElement`, however this isn't explicitly documented.
61 lines
1.8 KiB
TypeScript
61 lines
1.8 KiB
TypeScript
// Type definitions for React Router 4.2
|
|
// Project: https://github.com/ReactTraining/react-router
|
|
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
|
|
// Huy Nguyen <https://github.com/huy-nguyen>
|
|
// Philip Jackson <https://github.com/p-jackson>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
// TypeScript Version: 2.6
|
|
|
|
import { match } from "react-router";
|
|
import * as React from 'react';
|
|
import * as H from 'history';
|
|
|
|
export {
|
|
Prompt,
|
|
MemoryRouter,
|
|
RedirectProps,
|
|
Redirect,
|
|
RouteComponentProps,
|
|
RouteProps,
|
|
Route,
|
|
Router,
|
|
StaticRouter,
|
|
Switch,
|
|
match,
|
|
matchPath,
|
|
withRouter,
|
|
RouterChildContext
|
|
} from 'react-router';
|
|
|
|
export interface BrowserRouterProps {
|
|
basename?: string;
|
|
getUserConfirmation?: ((message: string, callback: (ok: boolean) => void) => void);
|
|
forceRefresh?: boolean;
|
|
keyLength?: number;
|
|
}
|
|
export class BrowserRouter extends React.Component<BrowserRouterProps, any> {}
|
|
|
|
export interface HashRouterProps {
|
|
basename?: string;
|
|
getUserConfirmation?: ((message: string, callback: (ok: boolean) => void) => void);
|
|
hashType?: 'slash' | 'noslash' | 'hashbang';
|
|
}
|
|
export class HashRouter extends React.Component<HashRouterProps, any> {}
|
|
|
|
export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
to: H.LocationDescriptor;
|
|
replace?: boolean;
|
|
innerRef?: (node: HTMLAnchorElement | null) => void;
|
|
}
|
|
export class Link extends React.Component<LinkProps, any> {}
|
|
|
|
export interface NavLinkProps extends LinkProps {
|
|
activeClassName?: string;
|
|
activeStyle?: React.CSSProperties;
|
|
exact?: boolean;
|
|
strict?: boolean;
|
|
isActive?<P>(match: match<P>, location: H.Location): boolean;
|
|
location?: H.Location;
|
|
}
|
|
export class NavLink extends React.Component<NavLinkProps, any> {}
|