diff --git a/types/react-virtualized/react-virtualized-tests.tsx b/types/react-virtualized/react-virtualized-tests.tsx index 504a6e2c17..5a816a7e1d 100644 --- a/types/react-virtualized/react-virtualized-tests.tsx +++ b/types/react-virtualized/react-virtualized-tests.tsx @@ -405,11 +405,7 @@ export class ColumnSizerExample extends PureComponent { _noColumnMaxWidthChange(event) { let columnMaxWidth = parseInt(event.target.value, 10) - if (isNaN(columnMaxWidth)) { - columnMaxWidth = undefined - } else { - columnMaxWidth = Math.min(1000, columnMaxWidth) - } + columnMaxWidth = isNaN(columnMaxWidth) ? undefined : Math.min(1000, columnMaxWidth) this.setState({ columnMaxWidth }) } @@ -417,11 +413,7 @@ export class ColumnSizerExample extends PureComponent { _noColumnMinWidthChange(event) { let columnMinWidth = parseInt(event.target.value, 10) - if (isNaN(columnMinWidth)) { - columnMinWidth = undefined - } else { - columnMinWidth = Math.max(1, columnMinWidth) - } + columnMinWidth = isNaN(columnMinWidth) ? undefined : Math.max(1, columnMinWidth) this.setState({ columnMinWidth }) } diff --git a/types/react/index.d.ts b/types/react/index.d.ts index cdea0f674f..e9aa299934 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -178,7 +178,8 @@ declare namespace React { type ReactInstance = Component | Element; // Base component for plain JS classes - class Component extends ComponentLifecycle { + interface Component extends ComponentLifecycle { } + class Component { constructor(props?: P, context?: any); setState(f: (prevState: S, props: P) => Pick, callback?: () => any): void; setState(state: Pick, callback?: () => any): void; @@ -251,7 +252,7 @@ declare namespace React { // Component Specs and Lifecycle // ---------------------------------------------------------------------- - class ComponentLifecycle { + interface ComponentLifecycle { componentWillMount?(): void; componentDidMount?(): void; componentWillReceiveProps?(nextProps: Readonly

, nextContext: any): void;