Chart.js icon indicating copy to clipboard operation
Chart.js copied to clipboard

[[email protected]] - [[email protected]] - Type issue with custom positioners using existing positioners as base position.

Open redalpha01 opened this issue 1 year ago • 1 comments

Expected behavior

Following the samples here and here should not lead to a type error.

Current behavior

When using the sample to create a custom positioner, a typescript error is shown The 'this' context of type 'TooltipPositionerMap' is not assignable to method's 'this' of type 'TooltipModel<keyof ChartTypeRegistry>'. Type 'TooltipPositionerMap' is missing the following properties from type 'TooltipModel<keyof ChartTypeRegistry>': chart, dataPoints, xAlign, yAlign, and 23 more.(2684)

Reproducible sample

https://stackblitz.com/edit/vitejs-vite-jgc8rw?file=src%2Fmain.ts

Optional extra steps/info to reproduce

The definition is in src/definitions/global.d.ts and the issue can be seen in src/main.ts

Possible solution

No response

Context

No response

chart.js version

4.4.4

Browser name and version

No response

Link to your project

No response

redalpha01 avatar Sep 19 '24 16:09 redalpha01

+1 to fix this. Its a bit silly this is the example that is in the docs and it gives type errors https://www.chartjs.org/docs/latest/samples/tooltip/position.html

Image

luka-bacic avatar Apr 15 '25 23:04 luka-bacic