Open
Description
Expected behavior
According to the docs, null
values are allowed for skipped values for Line Charts. The following code should pass the type check:
import { Chart } from 'chart.js';
var ctx = document.getElementById("myChart") as HTMLCanvasElement;
var myChart = new Chart<'line'>(ctx, {
// Config example from documentation
type: 'line',
data: {
datasets: [{
data: [{x: 10, y: 20}, {x: 15, y: null}, {x: 20, y: 10}]
// ~~~~ null value here, should be ok
}]
}
});
Current behavior
TypeScript error: Type 'null' is not assignable to type 'number'.
Reproducible sample
Optional extra steps/info to reproduce
Generic type should be specified for Chart constructor: new Chart<'line'>(...)
. There are no errors without it.
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