-
Notifications
You must be signed in to change notification settings - Fork 12k
fix(types): allow null for line chart point values (#12027) #12120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(types): allow null for line chart point values (#12027) #12120
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @LeeLenaleee , I’ve applied the suggested changes. Please re-review.
|
I had a type regression with the release 4.5.1, and went here to check. The link in the PR description (https://www.chartjs.org/docs/latest/charts/line.html#missing-data) says that |
|
It says it here in the spangaps property:
|
|
@LeeLenaleee thanks! |
|
As this breaks probably quite a few projects due missing nullable checks, it might have been more appropriate to place this change within a minor release instead of a bugfix. @LeeLenaleee @etimberg |
|
it's actually a breaking change, why did you release it as a patch? A lot of projects won't build cuz of this change. |
|
I can see why you see this as breaking, but the old implementation was breaking on runtime, now the developer is forced to handle this so it won't break on runtime. @etimberg what do we want to do with this, keep it or revert it since it is causing problems for others? |
|
I think we should keep it, since as you mentioned there were silent runtime errors before |


This PR updates the TypeScript definition for Point to allow null values for x and y.
According to the Chart.js documentation, null is valid for skipped values in line charts. However, the current typings only accept number, which causes TypeScript errors when using null in datasets.
Before
After
Example
Why this change is needed