Types: Object data format should allow null values for `y` for Line Charts
- Dominant language
- JavaScript
- Stars
- 67.7k
- Forks
- 11.9k
- Avg merge
- 7h 39m
- Merged PRs (30d)
- 5
Description
### Expected behavior
According to the [docs](https://www.chartjs.org/docs/latest/general/data-structures.html#object), `null` values are allowed for skipped values for Line Charts. The following code should pass the type check:
```ts
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
https://www.typescriptlang.org/play/?ssl=11&ssc=4&pln=10&pc=4#code/JYWwDg9gTgLgBAbzgYQBYENZwL5wGZQQhwDkAxhrAHQBWAziQNwCwAUGwG6ZxkwAecALxwAJhDIBXEAFMAdjCoBzaTACiAG2kz5AIQCeASREAKAEQg9aTDFMBKOOjpwAEgBUAsgBlk6WVzoaWnIwLKxcUHAWVljCstIA7iiUMAA8JOrAcSQAfMa8fAA0iGxwcDB6YNIAXKQZWQUlougw6DUIjaUizY4qdDUA2u2spSNNLQMIfDUAjAAMRXo1AEyz2EWTMwCsCzWyEurqa4hTcCs7cHPYALodODfDOGzYtoxAA
### 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_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.