Open
Description
Expected behavior
When declaring a ChartOptions with a declared type, IE:
private doughnutOptions: ChartOptions<"doughnut">
And initializing the options with a custom html legend,
this.doughnutOptions = {
plugins: {
...
htmlLegend: {
containerId: `myContainerId`,
}
}
}
There should be no lint errors on eslint.
Current behavior
When declaring ChartOptions with the above syntax, the following error is observed:
Object literal may only specify known properties, and 'htmlLegend' does not exist in type '_DeepPartialObject<PluginOptionsByType<"doughnut">>'.ts(2353)
This error can be cleared by changing the variable for chart options to:
private doughnutOptions: ChartOptions<any>
However, this fails our lint for typescript/no-redundant-type-constituents.
For now, we are considering disabling lint for that line, but we would like to know, is there something we're doing wrong that htmlLegend
is not appearing anywhere in our TypeScript definitions for chart.js? We are on version 4.4.3.
Reproducible sample
Optional extra steps/info to reproduce
No response
Possible solution
No response
Context
We are using a custom html legend for our doughnut charts
chart.js version
v4.4.3
Browser name and version
No response
Link to your project
No response