Skip to content

Commit f5ffcab

Browse files
authored
fix(types): bar chart data (#1087)
* fix(types): bar chart data * refactor: import order
1 parent 957d519 commit f5ffcab

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/typedCharts.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
RadarController,
1212
ScatterController
1313
} from 'chart.js'
14+
import type { DistributiveArray } from 'chart.js/dist/types/utils'
1415
import type { TypedChartComponent, ChartComponentRef } from './types.js'
1516
import { CommonProps } from './props.js'
1617
import { Chart } from './chart.js'
@@ -54,7 +55,14 @@ export function createTypedChart<
5455
}) as any
5556
}
5657

57-
export const Bar = /* #__PURE__ */ createTypedChart('bar', BarController)
58+
interface ExtendedDataPoint {
59+
[key: string]: string | number | null | ExtendedDataPoint
60+
}
61+
62+
export const Bar = /* #__PURE__ */ createTypedChart<
63+
'bar',
64+
DefaultDataPoint<'bar'> | DistributiveArray<ExtendedDataPoint>
65+
>('bar', BarController)
5866

5967
export const Doughnut = /* #__PURE__ */ createTypedChart(
6068
'doughnut',

0 commit comments

Comments
 (0)