mirror of
https://github.com/SomboChea/ui
synced 2024-12-01 02:14:27 +07:00
Merge pull request #79 from griffithtp/refactor/typescript-warning-withRoute
fix: @typescript-eslint/no-explicit-any
This commit is contained in:
commit
4746f4070c
@ -1,5 +1,5 @@
|
|||||||
import React, { Component, Fragment, ReactElement } from 'react';
|
import React, { Component, Fragment, ReactElement } from 'react';
|
||||||
import { withRouter, RouteProps } from 'react-router-dom';
|
import { withRouter, RouteComponentProps } from 'react-router-dom';
|
||||||
import CardContent from '@material-ui/core/CardContent';
|
import CardContent from '@material-ui/core/CardContent';
|
||||||
|
|
||||||
import { DetailContextConsumer, VersionPageConsumerProps } from '../../pages/version/Version';
|
import { DetailContextConsumer, VersionPageConsumerProps } from '../../pages/version/Version';
|
||||||
@ -7,18 +7,18 @@ import { DetailContextConsumer, VersionPageConsumerProps } from '../../pages/ver
|
|||||||
import { CardWrap, Heading, Tags, Tag } from './styles';
|
import { CardWrap, Heading, Tags, Tag } from './styles';
|
||||||
import NoItems from '../NoItems';
|
import NoItems from '../NoItems';
|
||||||
|
|
||||||
interface DepDetailProps {
|
type DepDetailProps = {
|
||||||
name: string;
|
name: string;
|
||||||
version: string;
|
version: string;
|
||||||
onLoading: () => void;
|
onLoading?: () => void;
|
||||||
history: string[];
|
} & RouteComponentProps;
|
||||||
}
|
|
||||||
interface DepDetailState {
|
interface DepDetailState {
|
||||||
name: string;
|
name: string;
|
||||||
version: string;
|
version: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
class DepDetail extends Component<DepDetailProps & RouteProps, DepDetailState> {
|
class DepDetail extends Component<DepDetailProps, DepDetailState> {
|
||||||
constructor(props: DepDetailProps) {
|
constructor(props: DepDetailProps) {
|
||||||
super(props);
|
super(props);
|
||||||
const { name, version } = this.props;
|
const { name, version } = this.props;
|
||||||
@ -39,12 +39,12 @@ class DepDetail extends Component<DepDetailProps & RouteProps, DepDetailState> {
|
|||||||
const { name } = this.state;
|
const { name } = this.state;
|
||||||
const { onLoading, history } = this.props;
|
const { onLoading, history } = this.props;
|
||||||
|
|
||||||
onLoading();
|
onLoading && onLoading();
|
||||||
history.push(`/-/web/detail/${name}`);
|
history.push(`/-/web/detail/${name}`);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const WrapperDependencyDetail = withRouter<any>(DepDetail);
|
const WrapperDependencyDetail = withRouter(DepDetail);
|
||||||
|
|
||||||
class DependencyBlock extends Component<{ title: string; dependencies: [] }> {
|
class DependencyBlock extends Component<{ title: string; dependencies: [] }> {
|
||||||
public render(): ReactElement<HTMLElement> {
|
public render(): ReactElement<HTMLElement> {
|
||||||
|
Loading…
Reference in New Issue
Block a user