@instructure/ui-react-utils
Version:
A React utility library made by Instructure Inc.
17 lines • 697 B
TypeScript
import { ComponentType, ReactElement, ReactNode } from 'react';
/**
* ---
* category: utilities/react
* ---
* Check if a React component instance (React element) matches one of the
* specified types.
*
* @module matchComponentTypes
* @param componentInstance
* @param types an array of React components
* @returns true if the component matches at least one of the types
*/
declare function matchComponentTypes<Type extends ReactElement = ReactElement>(componentInstance: ReactNode, types?: string[] | ComponentType[] | ComponentType<any>[]): componentInstance is Type;
export default matchComponentTypes;
export { matchComponentTypes };
//# sourceMappingURL=matchComponentTypes.d.ts.map