网站搜索

typescript - 类型 'IntrinsicAttributes & Props & { children?: ReactNode; }' 上不存在属性 'customerCode'


嘿,大家,我在 TypeScript 中遇到这个错误:Property does not exist on type 'IntrinsicAttributes & { children?: ReactNode; }' 我导出一个默认接口,叫做 iCustomer,我可以在整个项目中使用它。但现在我把它导入到了 CustomerViewList,因为我懒得在写 props 时重复自己。

在那之后,我想导入视图并在我的 FlatList 上使用它,但现在有点遇到这个错误。

答案#1

TypeScript 告诉你 CustomerViewList 没有一个名为 “customerCode” 的属性。看起来你定义了两个属性,customer 和 onPress。

你应该能够写 renderItem={({item}) => <CustomerViewList customer={item} onPress={onPress} /> }