Skip to content

Object literal may only specify known properties, and 'annotation' does not exist in specified type #886

@stockiNail

Description

@stockiNail

I tried version 3.0.0 and I have a new error :
Object literal may only specify known properties, and 'annotation' does not exist in type '_DeepPartialObject<PluginOptionsByType<keyof ChartTypeRegistry, keyof ChartTypeRegistry>>'.

With this code :

import { Chart } from "chart.js/auto";
import * as moment from 'moment';
import zoomPlugin from 'chartjs-plugin-zoom';
import annotationPlugin from 'chartjs-plugin-annotation';
import 'chartjs-adapter-moment';

Chart.register(annotationPlugin)

...

new Chart(chartRef.nativeElement, {
  type: 'bar',
  plugins: [zoomPlugin],
  data: {
	datasets: datasets
  },
  options: {
	responsive: true,
	maintainAspectRatio: false,
	plugins: {
	  zoom: {
		zoom: {
		  drag: {
			enabled: true
		  },
		  mode: 'x',
		},
	  },
	  annotation: { } // If I comment this line, error disappears. If I put content inside this object to draw my annotations, still have the error
	}
  },
})

My versions :
"chart.js": "^4.3.0",
"chartjs-adapter-moment": "^1.0.1",
"chartjs-plugin-annotation": "^3.0.0",
"chartjs-plugin-zoom": "^2.0.1",

If I remove zoom plugin, it works though. But I would like both plugins.
Any suggestion ?

Originally posted by @rfrancois in #877 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugtypesTypescript type changes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions