Skip to content

Commit 4746f40

Browse files
authored
Merge pull request conventional-changelog#79 from griffithtp/refactor/typescript-warning-withRoute
fix: @typescript-eslint/no-explicit-any
2 parents a0f0c80 + ec8ed12 commit 4746f40

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/components/Dependencies/Dependencies.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
import React, { Component, Fragment, ReactElement } from 'react';
2-
import { withRouter, RouteProps } from 'react-router-dom';
2+
import { withRouter, RouteComponentProps } from 'react-router-dom';
33
import CardContent from '@material-ui/core/CardContent';
44

55
import { DetailContextConsumer, VersionPageConsumerProps } from '../../pages/version/Version';
66

77
import { CardWrap, Heading, Tags, Tag } from './styles';
88
import NoItems from '../NoItems';
99

10-
interface DepDetailProps {
10+
type DepDetailProps = {
1111
name: string;
1212
version: string;
13-
onLoading: () => void;
14-
history: string[];
15-
}
13+
onLoading?: () => void;
14+
} & RouteComponentProps;
15+
1616
interface DepDetailState {
1717
name: string;
1818
version: string;
1919
}
2020

21-
class DepDetail extends Component<DepDetailProps & RouteProps, DepDetailState> {
21+
class DepDetail extends Component<DepDetailProps, DepDetailState> {
2222
constructor(props: DepDetailProps) {
2323
super(props);
2424
const { name, version } = this.props;
@@ -39,12 +39,12 @@ class DepDetail extends Component<DepDetailProps & RouteProps, DepDetailState> {
3939
const { name } = this.state;
4040
const { onLoading, history } = this.props;
4141

42-
onLoading();
42+
onLoading && onLoading();
4343
history.push(`/-/web/detail/${name}`);
4444
};
4545
}
4646

47-
const WrapperDependencyDetail = withRouter<any>(DepDetail);
47+
const WrapperDependencyDetail = withRouter(DepDetail);
4848

4949
class DependencyBlock extends Component<{ title: string; dependencies: [] }> {
5050
public render(): ReactElement<HTMLElement> {

0 commit comments

Comments
 (0)