Conversation
|
The reason I say the declare module 'react-chartist' {
// Should probably be in 'chartist'...
export type DrawElementType = 'area' | 'bar' | 'line' | 'point'
export type ChartistSVGElement = {
animate: (o: Object) => void
}
export type ChartistSVGPath = {
clone: () => ChartistSVGPath,
stringify: () => string,
scale: (x: number, y: number) => ChartistSVGPath,
translate: (x: number, y: number) => ChartistSVGPath,
}
export type ChartistSVGRect = {
x1: number,
y1: number,
x2: number,
y2: number,
width: () => number,
height: () => number,
}
export type DrawOptions = {
element: ChartistSVGElement,
index: number,
type: DrawElementType,
path?: ChartistSVGPath,
chartRect?: ChartistSVGRect,
}
// Should be 'react-chartist'
// There are several events, but they're not even officially documented within chartist. We at least (partially) handle 'draw'.
export type ChartistListenerOptions = {[key: string]: Function} & {
draw?: (o: DrawOptions) => void
}
// ... type definitions as in this PR
}However, that type information should be in DefinitelyTyped for Actually, import 'chartist'
import {IBarChartClasses as BarChartClasses} from 'chartist'
declare module 'chartist' {
export interface IBarChartClasses {
gridBackground?: string
}
export interface IBarChartOptions {
classNames?: BarChartClasses
}
}Unfortunately, don't have time to submit a DefinitelyTyped PR at the moment, if anyone else wants to then go for it. |
|
Thanks @Benjamin-Dobell for the fix, do you mind also bump the version number in this pull request? Will merge and publish a version after. |
|
Sorry to be that guy, but are you planning to merge this? Can I help somehow? |
|
@cironunes The Chartist types themselves are actually super messed up: DefinitelyTyped/DefinitelyTyped#36244 For example, there is no such thing as a candle graph, so the changes in this PR are off as well. I wanted to get the above merged first (before fixing these), but alas I just don't have the energy to fight poor process. |
Chartistinstead ofChartitresponsiveOptionsinstead ofresponseOptionslistener(not the best definition, butchartistitself doesn't even document the events)CandlegraphsLinethen the options (if specified) must beILineChartOptions.