【发布时间】:2019-06-25 22:04:04
【问题描述】:
您好,我正在使用 JS 和 TS 编写代码。我做了这个界面:
> interface IPLTableProps {
> Conf: [{ key: string, val: any }],
> Values?: [string],
> children?: ReactNode // TODO prendere children da React }
我定义了这个接口来创建一个通用组件。当我尝试在另一个文件中使用这个组件时,不知不觉我不得不将其称为通用组件。但是这里出现了错误。通用组件叫PLTable
<PLTable Conf={CONF}/>
CONF 是一个数组,当我尝试运行时出现此错误。
TS2741:类型 '{ label: string; 中缺少属性 '0'; }[]' 但 类型 '[{ 键:字符串;值:任何; }]'。
有人可以帮我吗?
【问题讨论】:
标签: javascript html typescript components