chartjs / chartjs/Chart.js

[Chart.js@4.4.4] - [typescript.js@5.5.3] - Type issue with custom positioners using existing positioners as base position.

Open
#11,902 1 comment 1 reaction 0 assignees View on GitHub
type: types
Dominant language
JavaScript
Stars
67.7k
Forks
11.9k
Avg merge
7h 39m
Merged PRs (30d)
5

Description

### Expected behavior

Following the samples [here](https://www.chartjs.org/docs/latest/configuration/tooltip.html) and [here](https://www.chartjs.org/docs/latest/samples/tooltip/position.html) 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'.
Type 'TooltipPositionerMap' is missing the following properties from type 'TooltipModel': 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_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.