Merge pull request #29133 from christianchown/master

[react-is] Add AsyncMode, ForwardRef and Profiler
This commit is contained in:
Andrew Casey
2018-09-24 13:55:48 -07:00
committed by GitHub
2 changed files with 12 additions and 2 deletions
+8 -2
View File
@@ -1,6 +1,7 @@
// Type definitions for react-is 16.3
// Type definitions for react-is 16.5
// Project: https://reactjs.org/
// Definitions by: Avi Vahl <https://github.com/AviVahl>
// Christian Chown <https://github.com/christianchown>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
@@ -10,17 +11,22 @@ import { ReactElement, ReactType } from 'react';
export function typeOf(value: any): symbol | undefined;
export function isValidElementType(value: any): value is ReactType;
export function isAsyncMode(value: any): value is ReactElement<any>;
export function isContextConsumer(value: any): value is ReactElement<any>;
export function isContextProvider(value: any): value is ReactElement<any>;
export function isElement(value: any): value is ReactElement<any>;
export function isForwardRef(value: any): value is ReactElement<any>;
export function isFragment(value: any): value is ReactElement<any>;
export function isProfiler(value: any): value is ReactElement<any>;
export function isPortal(value: any): value is ReactElement<any>;
export function isStrictMode(value: any): value is ReactElement<any>;
export const AsyncMode: symbol;
export const ContextProvider: symbol;
export const ContextConsumer: symbol;
export const Element: symbol;
export const ForwardRef: symbol;
export const Fragment: symbol;
export const Portal: symbol;
export const Profiler: symbol;
export const StrictMode: symbol;
+4
View File
@@ -72,3 +72,7 @@ ReactIs.typeOf(123) === undefined;
ReactIs.typeOf({}) === undefined;
ReactIs.typeOf(null) === undefined;
ReactIs.typeOf(undefined) === undefined;
// ForwardRef
const forwardRef = React.forwardRef((props, ref) => <div />);
ReactIs.isForwardRef(forwardRef); // true