Files
DefinitelyTyped/types/react-router-config/index.d.ts
T
Mathieu TUDISCOandSheetal Nandi bcfb1a08a8 [react-router-config] Add render key in route config. (#35805)
* Add render key in route config.

* Update with proper type directly from @types/react-router

* And update for nested routes.
2019-05-30 10:57:26 -07:00

42 lines
1.6 KiB
TypeScript

// Type definitions for react-router-config 5.0
// Project: https://github.com/ReactTraining/react-router/tree/master/packages/react-router-config, https://github.com/reacttraining/react-router
// Definitions by: François Nguyen <https://github.com/lith-light-g>
// John Reilly <https://github.com/johnnyreilly>
// Phoenix He <https://github.com/NullMDR>
// Mathieu TUDISCO <https://github.com/mathieutu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from "react";
import { RouteComponentProps, SwitchProps, match } from "react-router";
import { Location } from "history";
export interface RouteConfigComponentProps<Params extends { [K in keyof Params]?: string } = {}> extends RouteComponentProps<Params> {
route?: RouteConfig;
}
export interface RouteConfig {
key?: React.Key;
location?: Location;
component?: React.ComponentType<RouteConfigComponentProps<any>> | React.ComponentType;
path?: string;
exact?: boolean;
strict?: boolean;
routes?: RouteConfig[];
render?: (props: RouteConfigComponentProps<any>) => React.ReactNode;
[propName: string]: any;
}
export interface MatchedRoute<Params extends { [K in keyof Params]?: string }> {
route: RouteConfig;
match: match<Params>;
}
export function matchRoutes<Params extends { [K in keyof Params]?: string }>(routes: RouteConfig[], pathname: string): Array<MatchedRoute<Params>>;
export function renderRoutes(
routes: RouteConfig[] | undefined,
extraProps?: any,
switchProps?: SwitchProps,
): JSX.Element;