diff --git a/index.d.ts b/index.d.ts index b5b81bb..a25d9c6 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,37 +1,48 @@ -import { ChartitGraphProps } from './index.d'; -import * as React from 'react'; +import * as React from 'react' + import { + IBarChartOptions, + ICandleChartOptions, IChartOptions, - IResponsiveOptionTuple, ILineChartOptions, - IBarChartOptions, IPieChartOptions, -} from 'chartist'; - -export interface ChartitGraphProps { - type: string; - data: object; - className?: string; - options?: IChartOptions; - style?: React.CSSProperties; + IResponsiveOptionTuple, +} from 'chartist' + +export type ChartistListenerOptions = {[key: string]: Function} + +interface BaseChartistGraphProps { + data: Object + className?: string + options?: IChartOptions + style?: React.CSSProperties + listener?: ChartistListenerOptions } -export interface ChartitGraphLineProps extends ChartitGraphProps { - type: 'Line'; - options?: ILineChartOptions; - responseOptions?: Array>; +export interface ChartistGraphBarProps extends BaseChartistGraphProps { + type: 'Bar' + options: IBarChartOptions + responsiveOptions?: Array> } -export interface ChartitGraphPieProps extends ChartitGraphProps { - type: 'Pie'; - options?: IPieChartOptions; - responseOptions?: Array>; +export interface ChartistGraphCandleProps extends BaseChartistGraphProps { + type: 'Candle' + options: ICandleChartOptions + responsiveOptions?: Array> } -export interface ChartitGraphBarProps extends ChartitGraphProps { - type: 'Bar'; - options: IBarChartOptions; - responseOptions?: Array>; +export interface ChartistGraphLineProps extends BaseChartistGraphProps { + type: 'Line' + options?: ILineChartOptions + responsiveOptions?: Array> } -export default class ChartistGraph extends React.Component {} +export interface ChartistGraphPieProps extends BaseChartistGraphProps { + type: 'Pie' + options?: IPieChartOptions + responsiveOptions?: Array> +} + +export type ChartistGraphProps = ChartistGraphBarProps | ChartistGraphCandleProps | ChartistGraphLineProps | ChartistGraphPieProps + +export default class ChartistGraph extends React.Component {}