mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* 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
48 lines
1.1 KiB
TypeScript
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> {}
|