From: DustinEwan Date: Mon, 18 Nov 2024 20:43:17 +0000 (-0600) Subject: fix: correct typing for doughnut, pie, and polarArea charts (#11521) X-Git-Tag: v4.4.7~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3a515d08e8e999dd8366fe6f4a0723464903f9b4;p=thirdparty%2FChart.js.git fix: correct typing for doughnut, pie, and polarArea charts (#11521) * fix(#10896): correct typing for doughnut, pie, and polarArea charts * formatting --- diff --git a/src/types/index.d.ts b/src/types/index.d.ts index 0fbe356a3..c59a39c45 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -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 diff --git a/test/types/options.ts b/test/types/options.ts index a3b612f62..21d0ccf17 100644 --- a/test/types/options.ts +++ b/test/types/options.ts @@ -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', @@ -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 = doughnutOptions;