mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-14 04:43:14 +00:00
10 lines
384 B
TypeScript
10 lines
384 B
TypeScript
import { ComponentClass, Component, ComponentType } from 'react';
|
|
|
|
export function isReactClass(obj: any): obj is ComponentClass<any> {
|
|
return obj && obj.prototype && (obj.prototype.isReactComponent || obj.prototype instanceof Component);
|
|
}
|
|
|
|
export function isReactComponent(obj: any): obj is ComponentType<any> {
|
|
return obj && (isReactClass(obj) || typeof obj === 'function');
|
|
}
|