SIGN IN SIGN UP
chartjs / chart.js UNCLAIMED

Simple HTML5 Charts using the <canvas> tag

0 0 0 JavaScript

Fix helpers `Chart` type (#12012)

helpers.dom.ts functions referenced the internal `Chart` JavaScript class rather than the published `Chart<TType, TData, TLabel>` TypeScript definition. This causes errors when outside code tries to call helper functions.

The two `Chart` interfaces are incompatible - the `width`, `height`, and `currentDevicePixelRatio` properties are declared as readonly in the TS declaration but are manipulated by helpers.dom.ts functions, and helpers.dom.ts functions need to be invoked both by internal Chart.js code (which uses the JS class) and by outside code (which uses the TS types). To address this, I'm importing the JS version as `PrivateChart`. There may be a better solution.

It's my understanding that the comment about "typedefs are auto-exported" is obsolete now that helpers.dom is a native TS file.

Fixes #11153
J
Josh Kelley committed
370f6c385d648ab52f576824b9a22453fa4648f1
Parent: f744621
Committed by GitHub <noreply@github.com> on 1/30/2025, 9:29:19 AM