0

我想知道在这种情况下是否有办法使用 TypeScript 在运行时检查类型。该场景仅用于说明目的。

const SomeReactComponent = ({ children, inverseOrientation }) => {
    const header = findByType('ComponentHeader', children);
    const content = findBytype('ComponentContent', children);
    const footer = findByType('ComponentFooter, children);

    if(inverseOrientation) return <div> {[footer,content,header]} </div>;
    return <div>{children}</div>;
}
4

0 回答 0