UNPKG

2.06 kBTypeScriptView Raw
1import * as React from "react";
2/**
3 * An abstract component that Blueprint components can extend
4 * in order to add some common functionality like runtime props validation.
5 */
6export declare abstract class AbstractComponent<P, S = {}, SS = {}> extends React.Component<P, S, SS> {
7 componentWillUpdate: never;
8 componentWillReceiveProps: never;
9 componentWillMount: never;
10 getDerivedStateFromProps: never;
11 /** Component displayName should be `public static`. This property exists to prevent incorrect usage. */
12 protected displayName: never;
13 private timeoutIds;
14 private requestIds;
15 constructor(props: P);
16 componentDidUpdate(_prevProps: P, _prevState: S, _snapshot?: SS): void;
17 componentWillUnmount(): void;
18 /**
19 * Request an animation frame and remember its ID.
20 * All pending requests will be canceled when component unmounts.
21 *
22 * @returns a "cancel" function that will cancel the request when invoked.
23 */
24 requestAnimationFrame(callback: () => void): () => void;
25 /**
26 * Set a timeout and remember its ID.
27 * All stored timeouts will be cleared when component unmounts.
28 *
29 * @returns a "cancel" function that will clear timeout when invoked.
30 */
31 setTimeout(callback: () => void, timeout?: number): () => void;
32 /**
33 * Clear all known timeouts.
34 */
35 clearTimeouts: () => void;
36 /**
37 * Clear all known animation frame requests.
38 */
39 cancelAnimationFrames: () => void;
40 /**
41 * Ensures that the props specified for a component are valid.
42 * Implementations should check that props are valid and usually throw an Error if they are not.
43 * Implementations should not duplicate checks that the type system already guarantees.
44 *
45 * This method should be used instead of React's
46 * [propTypes](https://facebook.github.io/react/docs/reusable-components.html#prop-validation) feature.
47 * Like propTypes, these runtime checks run only in development mode.
48 */
49 protected validateProps(_props: P): void;
50}
51
\No newline at end of file