Skip to content

Commit

Permalink
fix: correct typing for doughnut, pie, and polarArea charts (#11521)
Browse files Browse the repository at this point in the history
* fix(#10896): correct typing for doughnut, pie, and polarArea charts

* formatting
  • Loading branch information
DustinEwan authored Nov 18, 2024
1 parent 49256c6 commit 3a515d0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ export interface DoughnutControllerDatasetOptions
spacing: number;
}

export interface DoughnutAnimationOptions {
export interface DoughnutAnimationOptions extends AnimationSpec<'doughnut'> {
/**
* If true, the chart will animate in with a rotation animation. This property is in the options.animation object.
* @default true
Expand Down
14 changes: 13 additions & 1 deletion test/types/options.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Chart } from '../../src/types.js';
import { Chart, ChartOptions, ChartType, DoughnutControllerChartOptions } from '../../src/types.js';

const chart = new Chart('test', {
type: 'bar',
Expand Down Expand Up @@ -31,3 +31,15 @@ const chart = new Chart('test', {
}
}
});

const doughnutOptions: DoughnutControllerChartOptions = {
circumference: 360,
cutout: '50%',
offset: 0,
radius: 100,
rotation: 0,
spacing: 0,
animation: false,
};

const chartOptions: ChartOptions<ChartType> = doughnutOptions;

0 comments on commit 3a515d0

Please sign in to comment.