我正在尝试使用带有react-chartjs 圆环图的插件。为了使用该插件(https://www.npmjs.com/package/@scottalan/chartjs-plugin-doughnutlabel),我必须将选项传递给组件。但是当我尝试传递选项时,出现类型错误
Type '{ doughnutlabel: { labels: { text: string; font: { size: string; family: string; style: string; weight: string; }; color: string; }[]; }; }' is not assignable to type '_DeepPartialObject<PluginOptionsByType<keyof ChartTypeRegistry>>'.
Object literal may only specify known properties, and 'doughnutlabel' does not exist in type '_DeepPartialObject<PluginOptionsByType<keyof ChartTypeRegistry>>'.
Run Code Online (Sandbox Code Playgroud)
我最好的猜测是,这ChartOptions是分配给我的错误类型options,因为我得到了相同的错误事件,而没有尝试将插件与const options: ChartOptions = {}. 我的完整代码如下,感谢任何帮助。
Type '{ doughnutlabel: { labels: { text: string; font: { size: string; family: string; style: string; weight: …Run Code Online (Sandbox Code Playgroud)