admin管理员组文章数量:1296307
Hi I'm writing a code using JS and TS. I've made this interface:
> interface IPLTableProps {
> Conf: [{ key: string, val: any }],
> Values?: [string],
> children?: ReactNode // TODO prendere children da React }
I defined this interface for create a general ponent. When I try to use this ponent in another file, obliviously I have to call is as a general ponent. But here it es the error. The general ponent it's called PLTable
<PLTable Conf={CONF}/>
CONF is an array, and when I try to run I get this error.
TS2741: Property '0' is missing in type '{ label: string; }[]' but required in type '[{ key: string; val: any; }]'.
Can someone help me?
Hi I'm writing a code using JS and TS. I've made this interface:
> interface IPLTableProps {
> Conf: [{ key: string, val: any }],
> Values?: [string],
> children?: ReactNode // TODO prendere children da React }
I defined this interface for create a general ponent. When I try to use this ponent in another file, obliviously I have to call is as a general ponent. But here it es the error. The general ponent it's called PLTable
<PLTable Conf={CONF}/>
CONF is an array, and when I try to run I get this error.
TS2741: Property '0' is missing in type '{ label: string; }[]' but required in type '[{ key: string; val: any; }]'.
Can someone help me?
Share Improve this question asked Feb 1, 2019 at 10:30 Giovanni GiampaoloGiovanni Giampaolo 4632 gold badges9 silver badges20 bronze badges1 Answer
Reset to default 8[type]
defines a tuple with a single element. You probably want an array which is defined using type[]
or Array<type>
interface IPLTableProps {
Conf: Array<{ key: string, val: any }>,
Values?: string[],
children?: ReactNode
}
本文标签: htmlTS2741 Property 39039 is missing in type 39 label stringJavascriptStack Overflow
版权声明:本文标题:html - TS2741 Property '0' is missing in type '{ label: string; } Javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741634804a2389578.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论