Open frenzymind opened 7 months ago
Chart.js comes with build in types since V3. The types package is only for V2.
These types are not compatible. If you could try to remove the types package and see if that resolves the issue
I remove package, but error still exist. I update reproducible sample (remove types).
There is no error for Chart.defaults.plugins.legend.onClick
, just for Chart.overrides['pie'].plugins.legend.onClick
Type assertion fix error and code seems work correctly.
Expected behavior
Call method without type issue
Current behavior
LegendElement<keyof ChartTypeRegistry> is not assignable to parameter of type LegendElement<"pie">
Reproducible sample
codesandbox
Optional extra steps/info to reproduce
No response
Possible solution
I have to use type assertion:
legend as LegendElement<'pie'>
Context
No response
chart.js version
chart.js v4.4.1 and types v2.9.41
Browser name and version
No response
Link to your project
No response