DefinitelyTyped/types/react-router-guard/index.d.ts
TSL c794e7209b React router guard (#41333)
* Add types react-router-guard package

* Add test for react-router-guard package

* Export for Loadable react-loadable

* Remove file react-router-guard-test.ts
2020-01-02 10:07:54 -08:00

48 lines
1.1 KiB
TypeScript

// Type definitions for react-router-guard 2.3
// Project: https://github.com/laptransang/react-router-guard#readme
// Definitions by: TSL <https://github.com/laptransang>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as React from 'react';
import * as H from 'history';
export const history: H.History;
export {
Loadable
} from 'react-loadable';
export {
BrowserRouter,
Link,
NavLink,
Route,
Router,
Switch,
} from 'react-router-dom';
export {
Redirect,
} from 'react-router';
export function lazy<T extends React.ComponentType<any>>(
factory: () => Promise<{ default: T }>
): React.LazyExoticComponent<T>;
export interface RouterGuardConfigProps {
path: string;
component: React.LazyExoticComponent<any>;
canActivate?: Array<() => Promise<any>>;
redirect?: string;
exact?: boolean;
routes?: RouterGuardConfigProps[];
}
export interface RouterGuardProps {
config: RouterGuardConfigProps[];
history?: H.History;
loading?: boolean | React.ReactElement;
}
export class RouterGuard<T> extends React.Component<RouterGuardProps, any> {}