From 3a515d08e8e999dd8366fe6f4a0723464903f9b4 Mon Sep 17 00:00:00 2001 From: DustinEwan Date: Mon, 18 Nov 2024 14:43:17 -0600 Subject: [PATCH] fix: correct typing for doughnut, pie, and polarArea charts (#11521) * fix(#10896): correct typing for doughnut, pie, and polarArea charts * formatting --- src/types/index.d.ts | 2 +- test/types/options.ts | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/types/index.d.ts b/src/types/index.d.ts index 0fbe356a3ae..c59a39c4581 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 a3b612f625d..21d0ccf17c7 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;