2๐
โ
I had more or less the same issue. I figured out that in chartjs-plugin-annotations
โs index.d.tx
file there was a deprecated definition of ChartOptions interface, which collided against the one defined in ng2-charts
.
So, in ~/project-folder/node_modules/@types/chartjs-plugin-annotation/index.d.ts
, change
// Extend the types from chart.js
declare module 'chart.js' {
interface ChartOptions {
// This is deprecated on master (not released yet)
annotation?: ChartJsAnnotation.AnnotationConfig;
}
// This is the correct version on master (not released yet)
// interface ChartPluginsOptions {
// annotation?: ChartJsAnnotation.AnnotationConfig;
// }
const Annotation: ChartJsAnnotation.AnnotationStatic;
}
to this
// Extend the types from chart.js
declare module 'chart.js' {
// interface ChartOptions {
// // This is deprecated on master (not released yet)
// annotation?: ChartJsAnnotation.AnnotationConfig;
// }
// This is the correct version on master (not released yet)
interface ChartPluginsOptions {
annotation?: ChartJsAnnotation.AnnotationConfig;
}
const Annotation: ChartJsAnnotation.AnnotationStatic;
}
Doing so removed the compiler error for me.
Source:stackexchange.com