From c698b78e3659f6525eac711c259d049826eacf72 Mon Sep 17 00:00:00 2001 From: Jer Date: Tue, 15 Aug 2017 07:19:11 -0500 Subject: [PATCH] added better typescript support --- index.d.ts | 34 +++++++++++++++------------------- package.json | 4 ++-- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/index.d.ts b/index.d.ts index d41a58ba1..662bba653 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for react-chartjs-2 2.0 -// Project: https://github.com/gor181/react-chartjs-2 +// Project: https://github.com/jerairrest/react-chartjs-2 // Definitions by: Alexandre Paré // Fabien Lavocat // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -8,7 +8,9 @@ import * as React from "react"; import * as chartjs from "chart.js"; -export type ChartDataFunction = (element: HTMLElement) => T; +export type ChartDataFunction = ( + element: HTMLElement +) => T; export type ChartData = ChartDataFunction | T; export interface ChartComponentProps { @@ -29,30 +31,24 @@ export interface LinearComponentProps extends ChartComponentProps { data: ChartData; } -export default class ChartComponent

extends React.Component

{ +export default class ChartComponent< + P extends ChartComponentProps +> extends React.Component

{ chart_instance: chartjs; } -export class Doughnut extends ChartComponent { -} +export class Doughnut extends ChartComponent {} -export class Pie extends ChartComponent { -} +export class Pie extends ChartComponent {} -export class Line extends ChartComponent { -} +export class Line extends ChartComponent {} -export class Bar extends ChartComponent { -} +export class Bar extends ChartComponent {} -export class HorizontalBar extends ChartComponent { -} +export class HorizontalBar extends ChartComponent {} -export class Radar extends ChartComponent { -} +export class Radar extends ChartComponent {} -export class Polar extends ChartComponent { -} +export class Polar extends ChartComponent {} -export class Bubble extends ChartComponent { -} +export class Bubble extends ChartComponent {} diff --git a/package.json b/package.json index f89718b1a..9e88cb90b 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "react-chartjs-2", - "version": "2.5.6", + "version": "2.5.7", "description": "react-chartjs-2", "main": "lib/index.js", - "author": "Goran Udosic", + "author": "Jeremy Ayerst", "homepage": "https://github.com/jerairrest/react-chartjs-2", "repository": { "type": "git",