diff --git a/src/typedCharts.ts b/src/typedCharts.ts index bea4f6e5..c8a4cbc7 100644 --- a/src/typedCharts.ts +++ b/src/typedCharts.ts @@ -11,6 +11,7 @@ import { RadarController, ScatterController } from 'chart.js' +import type { DistributiveArray } from 'chart.js/dist/types/utils' import type { TypedChartComponent, ChartComponentRef } from './types.js' import { CommonProps } from './props.js' import { Chart } from './chart.js' @@ -54,7 +55,14 @@ export function createTypedChart< }) as any } -export const Bar = /* #__PURE__ */ createTypedChart('bar', BarController) +interface ExtendedDataPoint { + [key: string]: string | number | null | ExtendedDataPoint +} + +export const Bar = /* #__PURE__ */ createTypedChart< + 'bar', + DefaultDataPoint<'bar'> | DistributiveArray +>('bar', BarController) export const Doughnut = /* #__PURE__ */ createTypedChart( 'doughnut',