1
1
import React , { Component , Fragment , ReactElement } from 'react' ;
2
- import { withRouter , RouteProps } from 'react-router-dom' ;
2
+ import { withRouter , RouteComponentProps } from 'react-router-dom' ;
3
3
import CardContent from '@material-ui/core/CardContent' ;
4
4
5
5
import { DetailContextConsumer , VersionPageConsumerProps } from '../../pages/version/Version' ;
6
6
7
7
import { CardWrap , Heading , Tags , Tag } from './styles' ;
8
8
import NoItems from '../NoItems' ;
9
9
10
- interface DepDetailProps {
10
+ type DepDetailProps = {
11
11
name : string ;
12
12
version : string ;
13
- onLoading : ( ) => void ;
14
- history : string [ ] ;
15
- }
13
+ onLoading ? : ( ) => void ;
14
+ } & RouteComponentProps ;
15
+
16
16
interface DepDetailState {
17
17
name : string ;
18
18
version : string ;
19
19
}
20
20
21
- class DepDetail extends Component < DepDetailProps & RouteProps , DepDetailState > {
21
+ class DepDetail extends Component < DepDetailProps , DepDetailState > {
22
22
constructor ( props : DepDetailProps ) {
23
23
super ( props ) ;
24
24
const { name, version } = this . props ;
@@ -39,12 +39,12 @@ class DepDetail extends Component<DepDetailProps & RouteProps, DepDetailState> {
39
39
const { name } = this . state ;
40
40
const { onLoading, history } = this . props ;
41
41
42
- onLoading ( ) ;
42
+ onLoading && onLoading ( ) ;
43
43
history . push ( `/-/web/detail/${ name } ` ) ;
44
44
} ;
45
45
}
46
46
47
- const WrapperDependencyDetail = withRouter < any > ( DepDetail ) ;
47
+ const WrapperDependencyDetail = withRouter ( DepDetail ) ;
48
48
49
49
class DependencyBlock extends Component < { title : string ; dependencies : [ ] } > {
50
50
public render ( ) : ReactElement < HTMLElement > {
0 commit comments