React-typescript chart.js 类型中缺少错误 'type'

React-typescript chart.js error 'type' is missing in type

我正在学习 typescript,最近从 React 转移过来,我在我的 react-typescript 项目中使用 chart js 制作一些图表,几个小时后我收到这个错误

Property 'type' is missing in type '{ data: { labels: string[]; datasets: { label: string; data: number[]; fill: boolean; backgroundColor: string; borderColor: string; }[]; }; options: { scales: { yAxes: { ticks: { beginAtZero: boolean; }; }[]; }; }; }' but required in type 'Props'

如果有人能帮助我,那就太好了 谢谢

即使 react-chartjs-2 不期望 Line 组件的类型道具,并且它的值默认分配给 line ,所使用的接口具有所需的类型道具。请找接口here

请将类型属性传递给 link 标签。

<line type='line' data={data} />