fix: give the plugin geometry its own non-nullable Point - #970
Merged
Merged
Conversation
Chart.js 4.5 widened Point to `{ x: number | null; y: number | null }` so it
can also describe a gap in a dataset. The plugin used that same type for
canvas geometry, so bumping the dev dependency to 4.5.1 (chartjs#962) fails to
compile with 15 errors across core, gestures, handlers, scale.types and utils.
Every one of those is a zoom centre, a drag corner, a pan delta or a hit test
position -- a real coordinate that is never null. Rather than null check values
that cannot be null, Point is now declared in src/types.ts and the geometry
imports it from there. Chart.js keeps being imported for everything else.
This also tightens the public API in the right direction: passing a Chart.js
Point, which may now hold nulls, into chart.zoomRect() or chart.pan() no
longer type checks, and it would have misbehaved at runtime.
Compiles and passes the browser tests against both 4.4.8 and 4.5.1, so chartjs#962
should go green once it is rebased on this.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Chart.js 4.5 widened Point to
{ x: number | null; y: number | null }so it can also describe a gap in a dataset. The plugin used that same type for canvas geometry, so bumping the dev dependency to 4.5.1 (#962) fails to compile with 15 errors across core, gestures, handlers, scale.types and utils.Every one of those is a zoom centre, a drag corner, a pan delta or a hit test position -- a real coordinate that is never null. Rather than null check values that cannot be null, Point is now declared in src/types.ts and the geometry imports it from there. Chart.js keeps being imported for everything else.
This also tightens the public API in the right direction: passing a Chart.js Point, which may now hold nulls, into chart.zoomRect() or chart.pan() no longer type checks, and it would have misbehaved at runtime.
Compiles and passes the browser tests against both 4.4.8 and 4.5.1, so #962 should go green once it is rebased on this.