From 9e607119abe91d47b284ee520cc1cd31cd631a37 Mon Sep 17 00:00:00 2001 From: Matt Gibbs Date: Fri, 25 Sep 2015 17:53:42 -0400 Subject: [PATCH] Restricting typing of data to Object This should at least stop primitives until I can figure out the structure of each type of data. --- chartist/chartist.d.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/chartist/chartist.d.ts b/chartist/chartist.d.ts index 7c2971e57..d55f87680 100644 --- a/chartist/chartist.d.ts +++ b/chartist/chartist.d.ts @@ -19,7 +19,7 @@ declare module Chartist { interface IChartistBase { container: any; - data: any; + data: Object; defaultOptions: T; options: T; responsiveOptions: Array>; @@ -31,8 +31,16 @@ declare module Chartist { supportsAnimations: boolean; resizeListener: any; - update(data: any, options?: T, override?: boolean): void; + update(data: Object, options?: T, override?: boolean): void; detatch(): void; + + /** + * Use this function to register event handlers. The handler callbacks are synchronous and will run in the main thread rather than the event loop. + * + * @method on + * @param event {string} Name of the event. Check the examples for supported events. + * @param handler {Function} The handler function that will be called when an event with the given name was emitted. This function will receive a data argument which contains event data. See the example for more details. + */ on(event: string, handler: Function): IChartistBase; /** @@ -41,21 +49,20 @@ declare module Chartist { * @method off * @param event {string} Name of the event for which a handler should be removed * @param handler {Function} The handler function that that was previously used to register a new event handler. This handler will be removed from the event handler list. If this parameter is omitted then all event handlers for the given event are removed from the list. - * @returns {IChartistBase} */ off(event: string, handler?: Function): IChartistBase; } interface IChartistPieChart extends IChartistBase { - new (target: any, data: any, options?: IPieChartOptions, responsiveOptions?: Array>): IChartistPieChart; + new (target: any, data: Object, options?: IPieChartOptions, responsiveOptions?: Array>): IChartistPieChart; } interface IChartistLineChart extends IChartistBase { - new (target: any, data: any, options?: ILineChartOptions, responsiveOptions?: Array>): IChartistLineChart; + new (target: any, data: Object, options?: ILineChartOptions, responsiveOptions?: Array>): IChartistLineChart; } interface IChartistBarChart extends IChartistBase { - new (target: any, data: any, options?: IBarChartOptions, responsiveOptions?: Array>): IChartistBarChart; + new (target: any, data: Object, options?: IBarChartOptions, responsiveOptions?: Array>): IChartistBarChart; } interface IChartOptions {