-
-
Notifications
You must be signed in to change notification settings - Fork 830
Open
Description
Would you like to work on a fix?
- Check this if you would like to implement a PR, we are more than happy to help you go through the process.
Current and expected behavior
Bar component has these typings in vue-chartjs/dist/typedCharts.d.ts
:
export declare const Bar: TypedChartComponent<"bar", (number | [number, number] | null)[], unknown>;
The chart data can be also an array of objects like [{ x: Date; y: number }]
or similar. When I provide such data type to the Bar component, I receive related type errors from vue-tsc:
Type '{ datasets: { label: string; data: { x: Date; y: number; }[]; backgroundColor: string; grouped: boolean; maxBarThickness: number; }[]; }' is not assignable to type 'ChartData<"bar", (number | [number, number] | null)[], unknown>'.
In the reproduction section, don't forget to run project in the TypeScript workspace (the sandbox has JS workspace so you will not see any errors)
Reproduction
https://stackblitz.com/edit/github-ucglyx?file=src%2FApp.vue
chart.js version
v4.4.0
vue-chartjs version
v5.2.0
Possible solution
Adjust the typings
noygafni, sindrig, KristinnVikar, ngekoding, jeffgran and 3 more
Metadata
Metadata
Assignees
Labels
No labels