chartjs-plugin-annotation: Error TS2567 when using this plugin in version 2.1.2

When I install this plugin and import it I get an error:

Error: node_modules/chartjs-plugin-annotation/types/index.d.ts:6:13 - error TS2428: All declarations of 'PluginOptionsByType' must have identical type parameters.

6   interface PluginOptionsByType<TType extends ChartType> {
              ~~~~~~~~~~~~~~~~~~~

I am using chartjs 4.2.1. When using version 2.0.1 of this plugin everything works. However I dont think thats a proper solution.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 17

Most upvoted comments

As workaround, you could set skipLibCheck: true to your tsconfig.

@KevinSafeguard thank youuuu! very helpful! I think it’s Chart.js issue and I raised it in chartjs slack dev channel. I’m thinking that because if you change the sequence of the "import"s for zoom and annotation plugins in your code (chart.component.ts file) then the error is occurring for zoom plugin instead of the annotation one.

@stockiNail Attached you find a reproducible sample. In this case its a combination of chart.js@4.2.1, chartjs-plugin-annotation@2.2.1 and chartjs-plugin-zoom@2.0.1 causing this issue.

chartjs-plugins-test.zip

@stockiNail I’m using chart.js 4.2.0 and the the latest version of this plugin and it is not working, I have tried to install an older version of this package (even though that’s not a good idea ) and it wont install because it says it is not compatible with the cahrt.js newer version