diff --git a/packages/umi/link.d.ts b/packages/umi/link.d.ts index 81aae2cc6585..6745fb7356a1 100644 --- a/packages/umi/link.d.ts +++ b/packages/umi/link.d.ts @@ -1,18 +1,2 @@ -import * as React from 'react'; - -declare class Link extends React.Component<{ - to: string | { - pathname: string, - search?: string, - hash?: string, - state?: any, - }, - replace?: boolean, - innerRef?: Function, - title?: string, - id?: string, - className?: string, -}, any> { - render(): JSX.Element; -} +import { Link } from 'react-router-dom'; export default Link; diff --git a/packages/umi/navlink.d.ts b/packages/umi/navlink.d.ts index 20b4bdda9bb7..b237f53db859 100644 --- a/packages/umi/navlink.d.ts +++ b/packages/umi/navlink.d.ts @@ -1,24 +1,2 @@ -import * as React from 'react'; - -declare class NavLink extends React.Component<{ - to: string | { - pathname: string, - search: string, - hash: string, - state: any, - }, - replace?: boolean, - innerRef?: Function, - title?: string, - id?: string, - className?: string, - activeClassName?: string, - activeStyle?: object, - exact?: boolean, - strict?: boolean, - isActive?: Function, - location?: object, -}, any> { - render(): JSX.Element; -} +import { NavLink } from 'react-router-dom'; export default NavLink; diff --git a/packages/umi/package.json b/packages/umi/package.json index 87555a05e024..09cd79c48ba0 100644 --- a/packages/umi/package.json +++ b/packages/umi/package.json @@ -6,6 +6,7 @@ "@babel/core": "^7.0.0", "@babel/runtime": "^7.0.0", "@types/react": "^16.4.9", + "@types/react-router-dom": "4.x", "babel-preset-umi": "^1.2.1", "debug": "^3.1.0", "dotenv": "^6.0.0", diff --git a/packages/umi/prompt.d.ts b/packages/umi/prompt.d.ts new file mode 100644 index 000000000000..2a9b3d08db94 --- /dev/null +++ b/packages/umi/prompt.d.ts @@ -0,0 +1,2 @@ +import { Prompt } from 'react-router-dom'; +export default Prompt; diff --git a/packages/umi/redirect.d.ts b/packages/umi/redirect.d.ts index ec4f78de9f50..b0cdcfac8362 100644 --- a/packages/umi/redirect.d.ts +++ b/packages/umi/redirect.d.ts @@ -1,17 +1,2 @@ -import * as React from 'react'; - -declare class Redirect extends React.Component<{ - to: string | { - pathname: string, - search: string, - hash: string, - state: any, - }, - push?: boolean, - from?: string, - exact?: boolean, - strict?: boolean, -}, any> { - render(): JSX.Element; -} +import { Redirect } from 'react-router-dom'; export default Redirect; diff --git a/packages/umi/withRouter.d.ts b/packages/umi/withRouter.d.ts index 620d5c9fd53a..8aca9518656d 100644 --- a/packages/umi/withRouter.d.ts +++ b/packages/umi/withRouter.d.ts @@ -1,2 +1,2 @@ -declare const withRouter: (component:Function) => Function; +import { withRouter } from 'react-router-dom'; export default withRouter;