-
Notifications
You must be signed in to change notification settings - Fork 12k
Description
Expected behavior
I'm expecting that importing the plugins, registering them and then configure them in chart options, the project is compiled and working
Current behavior
I see some issues TS module augmentation used to define the plugins.
The first issue was related to PR #11244 which is forcing the plugins to add the default type to avoid issues on TS compiling.
interface PluginOptionsByType<TType extends ChartType = ChartType>
This update has been applied to annotation plugin but there is some open points about this change: chartjs/chartjs-plugin-datalabels#376
This issue has been introduced by version 4.1.0, probably by PR #10963
Anyway, adding the default type, the compiler is complaining about the plugin options:
Object literal may only specify known properties, and 'annotation' does not exist in type '_DeepPartialObject<PluginOptionsByType<keyof ChartTypeRegistry, keyof ChartTypeRegistry>>'.
See issue in annotation plugin: chartjs/chartjs-plugin-annotation#886
The issue is not related to annotation itself because testing only zoom and datalabels, the issue remains.
It seems that the module augmentation is ignoring the update to the types after the first one, therefore it depends on the order of the imports.
Reproducible sample
Project published here: chartjs/chartjs-plugin-annotation#854 (comment)
Optional extra steps/info to reproduce
I changed chart.js version, using 4.3.0 and annotation 3.0.0. Furthermore I have changed index.d.ts of chartjs-zoom-plugin setting the default type.
Furthermore add annotation and zoom (as empty object) to plugins chart options.
Possible solution
No response
Context
No response
chart.js version
v4.3.0
Browser name and version
No response
Link to your project
No response