Open
Description
Expected behavior
There shouldn't be any type error when writing something like this:
options: {
scales: {
y: {
beginAtZero: true,
},
},
onClick(event, elements, chart) {
const canvasPosition = getRelativePosition(event, chart);
const dataX = chart.scales.x.getValueForPixel(canvasPosition.x);
alert(dataX);
},
},
Current behavior
This type error is present:
Argument of type 'Chart<keyof ChartTypeRegistry, (number | [number, number] | Point | BubbleDataPoint | null)[], unknown>' is not assignable to parameter of type 'Chart'.
Type 'Chart<keyof ChartTypeRegistry, (number | [number, number] | Point | BubbleDataPoint | null)[], unknown>' is missing the following properties from type 'Chart': _options, _aspectRatio, _layers, _metasets, and 40 more.typescript(2345)
(parameter) chart: Chart<keyof ChartTypeRegistry, (number | [number, number] | Point | BubbleDataPoint | null)[], unknown>
Reproducible sample
https://codesandbox.io/p/sandbox/reverent-noyce-x7wm8r
Optional extra steps/info to reproduce
No response
Possible solution
No response
Context
No response
chart.js version
v4.4.7
Browser name and version
No response
Link to your project
No response