Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(#10896): correct typing for doughnut, pie, and polarArea charts #11521

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/types/index.d.ts
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
@@ -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;