Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 财产';儿童';类型'中缺少;{image:string;amount:number;}';但类型为';横幅层';。TS2741_Reactjs_Typescript - Fatal编程技术网

Reactjs 财产';儿童';类型'中缺少;{image:string;amount:number;}';但类型为';横幅层';。TS2741

Reactjs 财产';儿童';类型'中缺少;{image:string;amount:number;}';但类型为';横幅层';。TS2741,reactjs,typescript,Reactjs,Typescript,目前,我在使用名为React Scroll Parallax的库时遇到了一个错误。JS没有问题,但TS一直对我说: import*as React from'React'; 从“react scroll parallax”导入{ParallaxProvider,ParallaxBanner}; 从“样式化组件”导入样式化; 接口子网络操作{ 高度?:字符串; 风格?:任何; 背景图片?:任何; } const Wrapper=styled.div` 利润率:800px0; `; const Su

目前,我在使用名为React Scroll Parallax的库时遇到了一个错误。JS没有问题,但TS一直对我说:

import*as React from'React';
从“react scroll parallax”导入{ParallaxProvider,ParallaxBanner};
从“样式化组件”导入样式化;
接口子网络操作{
高度?:字符串;
风格?:任何;
背景图片?:任何;
}
const Wrapper=styled.div`
利润率:800px0;
`;
const SubBanner:React.FC=({height})=>{
返回(
);
};
导出默认子容器;
这个库似乎不支持当前的TS,那么如何解决这个问题呢?? 我需要和TS一起使用它

Property 'children' is missing in type '{ image: string; amount: number; }' but required in type 'BannerLayer'.ts(2741)

通常,当您尝试在React组件中使用不明确允许此操作的
子项
(不公开
子项
道具)时,会引发此错误


问题来自于
react-scroll-parallax
打字,已通过解决。

横幅层在哪里?
interface IComponentProps {
   image:string;
   amount:number;
}

<Component image="image" amount={1}>
  <p>This will throw</p>
</Component>
interface IComponentProps {

   image:string;
   amount:number;

  children: ReactNode;
}