Skip to content

Commit

Permalink
fix(types): bar chart data (#1087)
Browse files Browse the repository at this point in the history
* fix(types): bar chart data

* refactor: import order
  • Loading branch information
Oleksii14 authored Apr 8, 2024
1 parent 957d519 commit f5ffcab
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/typedCharts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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<ExtendedDataPoint>
>('bar', BarController)

export const Doughnut = /* #__PURE__ */ createTypedChart(
'doughnut',
Expand Down

0 comments on commit f5ffcab

Please sign in to comment.