Reactjs 属性不存在于类型';内在的颂词;{children?:ReactNode;}';

Reactjs 属性不存在于类型';内在的颂词;{children?:ReactNode;}';,reactjs,typescript,create-react-app,react-hoc,intrinsicattributes,Reactjs,Typescript,Create React App,React Hoc,Intrinsicattributes,我已经创建了由Create react App创建的react项目,其中包含以下软件包(提及与我的问题相关的软件包): 我已经创建了一个简单的HOC(目前它什么都不做,但稍后我会添加我的逻辑),如下所示: type Props = { [key: string]: any; }; const connect = function (Component: FunctionComponent): FunctionComponent { const ComponentWrapper

我已经创建了由
Create react App
创建的react项目,其中包含以下软件包(提及与我的问题相关的软件包):

我已经创建了一个简单的HOC(目前它什么都不做,但稍后我会添加我的逻辑),如下所示:

type Props = {
    [key: string]: any;
};


const connect = function (Component: FunctionComponent): FunctionComponent {
    const ComponentWrapper = function (props: Props): ReactElement {
        return <Component {...props} />;
    };

    return ComponentWrapper;
};
    const Test: FunctionComponent<Props> = function ({ message }: Props) {
        return (
            <div>{message}</div>
        );
    };


export default connect(Test);
<Test message="Testing message" />
我试过人们在谷歌上其他类似的堆栈溢出问题和文章中提出的建议,但到目前为止都没有效果

const connect=函数(组件:React.FC):React.FC{
const connect = function (Component: React.FC): React.FC<Props> {
    const ComponentWrapper = function (props: Props): JSX.Element {
        return <Component {...props} />;
    };

    return ComponentWrapper;
};
const ComponentWrapper=函数(props:props):JSX.Element{ 返回; }; 返回组件包装器; };

重新启动编译器后,它会正常工作。

如果您认为您已经研究过的问题可能存在重复项,请务必列出它们,并说明它们不适用的原因。但是,通常最好不要声明根本没有重复项,因为您无法检查所有可能的问题。读者们希望如果有重复的问题,你也能接受。@halfer早些时候我得到了很多反对票,只是因为SO上的一些用户发现了重复的问题,尽管这些问题不是重复的,我不得不删除这些问题。谢谢您的关注。“重新启动编译器后,它会工作正常”是的,它会!泰!
Type '{ message: string; }' is not assignable to type 'IntrinsicAttributes & { children?: ReactNode; }'.
  Property 'message' does not exist on type 'IntrinsicAttributes & { children?: ReactNode; }'.  TS2322
const connect = function (Component: React.FC): React.FC<Props> {
    const ComponentWrapper = function (props: Props): JSX.Element {
        return <Component {...props} />;
    };

    return ComponentWrapper;
};