UNPKG

1.21 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 | React.JSXElementConstructor<any>> | undefined;
14/**
15 * Returns true if the given JSX element matches the given component type.
16 *
17 * NOTE: This function only checks equality of `displayName` for performance and
18 * to tolerate multiple minor versions of a component being included in one
19 * application bundle.
20 *
21 * @param element JSX element in question
22 * @param ComponentType desired component type of element
23 */
24export declare function isElementOfType<P = {}>(element: any, ComponentType: React.ComponentType<P>): element is React.ReactElement<P>;