Skip to content

Commit

Permalink
feat(typescript): Add basic typescript definitions
Browse files Browse the repository at this point in the history
Adds basic type definitions

- Fixes apertureless#376
  • Loading branch information
apertureless authored Jul 16, 2018
1 parent ca9c1f4 commit 184be5c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@
"unpkg": "dist/vue-chartjs.min.js",
"module": "es/index.js",
"jsnext:main": "es/index.js",
"typings": "types/index.d.ts",
"files": [
"src",
"dist",
"es"
"es",
"types/*.d.ts"
],
"scripts": {
"dev": "node build/dev-server.js",
Expand Down
7 changes: 7 additions & 0 deletions types/components.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Vue from 'vue'

/** vue-chartjs component common definition */
export declare class BaseChart extends Vue {
addPlugin (plugin?: string[]): void
renderChart (chartData: any, options?: any): void
}
19 changes: 19 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { BaseChart } from './components'

declare module 'vue-chartjs' {
export function generateChart(chartId: string, chartType: string): any;
export class Bar extends BaseChart {}
export class HorizontalBar extends BaseChart {}
export class Doughnut extends BaseChart {}
export class Line extends BaseChart {}
export class Pie extends BaseChart {}
export class PolarArea extends BaseChart {}
export class Radar extends BaseChart {}
export class Bubble extends BaseChart {}
export class Scatter extends BaseChart {}
export const mixins: {
reactiveData: any
reactiveProp: any
}
}

0 comments on commit 184be5c

Please sign in to comment.