UNPKG

2.27 kBTypeScriptView Raw
1import * as React from "react";
2/**
3 * Returns true if `node` is null/undefined, false, empty string, or an array
4 * composed of those. If `node` is an array, only one level of the array is
5 * checked, for performance reasons.
6 */
7export declare function isReactNodeEmpty(node?: React.ReactNode, skipArray?: boolean): boolean;
8/**
9 * Converts a React node to an element: non-empty string or number or
10 * `React.Fragment` (React 16.3+) is wrapped in given tag name; empty strings
11 * and booleans are discarded.
12 */
13export declare function ensureElement(child: React.ReactNode | undefined, tagName?: keyof JSX.IntrinsicElements): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | undefined;
14/**
15 * Represents anything that has a `name` property such as Functions.
16 */
17interface INamed {
18 name?: string;
19}
20/**
21 * @deprecated will be removed in 4.0
22 */
23export declare function getDisplayName(ComponentClass: React.ComponentType | INamed): string;
24/**
25 * Returns true if the given JSX element matches the given component type.
26 *
27 * NOTE: This function only checks equality of `displayName` for performance and
28 * to tolerate multiple minor versions of a component being included in one
29 * application bundle.
30 *
31 * @param element JSX element in question
32 * @param ComponentType desired component type of element
33 */
34export declare function isElementOfType<P = {}>(element: any, ComponentType: React.ComponentType<P>): element is React.ReactElement<P>;
35/**
36 * Returns React.createRef if it's available, or a ref-like object if not.
37 *
38 * @deprecated use React.createRef or React.useRef
39 */
40export declare function createReactRef<T>(): React.RefObject<T>;
41/**
42 * Replacement type for { polyfill } from "react-lifecycles-compat" useful in some places where
43 * the correct type is not inferred automatically. This should be removed once Blueprint depends on React >= 16.
44 * HACKHACK part of https://github.com/palantir/blueprint/issues/4342
45 *
46 * @deprecated use React 16
47 */
48export declare type LifecycleCompatPolyfill<P, T extends React.ComponentClass<P>> = (Comp: T) => T & {
49 [K in keyof T]: T[K];
50};
51export {};