Skip to content

Commit 9293dda

Browse files
authored
Minor type fixes (#8719)
* Update RadialLinearScaleOptions.pointLabels.callback type The code passes `index` as the second parameter, and one of the tests uses this. `@default true` doesn't seem to make sense. * Add types for additional documented parameters in tooltip callbacks
1 parent 7fff21b commit 9293dda

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

types/index.esm.d.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2370,9 +2370,9 @@ export interface TooltipOptions<TType extends ChartType> extends CoreInteraction
23702370
/**
23712371
* Sort tooltip items.
23722372
*/
2373-
itemSort: (a: TooltipItem<ChartType>, b: TooltipItem<ChartType>) => number;
2373+
itemSort: (a: TooltipItem<ChartType>, b: TooltipItem<ChartType>, data: ChartData) => number;
23742374

2375-
filter: (e: TooltipItem<ChartType>) => boolean;
2375+
filter: (e: TooltipItem<ChartType>, index: number, array: TooltipItem<ChartType>[], data: ChartData) => boolean;
23762376

23772377
/**
23782378
* Background color of the tooltip.
@@ -3041,7 +3041,7 @@ export type RadialLinearScaleOptions = CoreScaleOptions & {
30413041
* Padding of label backdrop.
30423042
* @default 2
30433043
*/
3044-
backdropPadding: Scriptable<number | ChartArea, ScriptableScaleContext>;
3044+
backdropPadding: Scriptable<number | ChartArea, ScriptableScaleContext>;
30453045

30463046
/**
30473047
* if true, point labels are shown.
@@ -3060,9 +3060,8 @@ export type RadialLinearScaleOptions = CoreScaleOptions & {
30603060

30613061
/**
30623062
* Callback function to transform data labels to point labels. The default implementation simply returns the current string.
3063-
* @default true
30643063
*/
3065-
callback: (label: string) => string;
3064+
callback: (label: string, index: number) => string;
30663065
};
30673066

30683067
/**

0 commit comments

Comments
 (0)