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 component. When I try to use this component in another file, obliviously I have to call is as a general component. But here it comes the error. The general component 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?
[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
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With