mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 04:01:52 +00:00
Add a Component interface that merges w/the class
The Component interface extends ComponentLifecycle. ComponentLifecycle goes back to being an interface. Also fix some lint in react-virtualized
This commit is contained in:
@@ -405,11 +405,7 @@ export class ColumnSizerExample extends PureComponent<any, any> {
|
||||
_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<any, any> {
|
||||
_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 })
|
||||
}
|
||||
|
||||
Vendored
+3
-2
@@ -178,7 +178,8 @@ declare namespace React {
|
||||
type ReactInstance = Component<any, any> | Element;
|
||||
|
||||
// Base component for plain JS classes
|
||||
class Component<P, S> extends ComponentLifecycle<P, S> {
|
||||
interface Component<P, S> extends ComponentLifecycle<P, S> { }
|
||||
class Component<P, S> {
|
||||
constructor(props?: P, context?: any);
|
||||
setState<K extends keyof S>(f: (prevState: S, props: P) => Pick<S, K>, callback?: () => any): void;
|
||||
setState<K extends keyof S>(state: Pick<S, K>, callback?: () => any): void;
|
||||
@@ -251,7 +252,7 @@ declare namespace React {
|
||||
// Component Specs and Lifecycle
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
class ComponentLifecycle<P, S> {
|
||||
interface ComponentLifecycle<P, S> {
|
||||
componentWillMount?(): void;
|
||||
componentDidMount?(): void;
|
||||
componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
|
||||
|
||||
Reference in New Issue
Block a user