Skip to content

Commit

Permalink
Minor type fixes (#8719)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
joshkel committed Mar 25, 2021
1 parent 7fff21b commit 9293dda
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions types/index.esm.d.ts
Expand Up @@ -2370,9 +2370,9 @@ export interface TooltipOptions<TType extends ChartType> extends CoreInteraction
/**
* Sort tooltip items.
*/
itemSort: (a: TooltipItem<ChartType>, b: TooltipItem<ChartType>) => number;
itemSort: (a: TooltipItem<ChartType>, b: TooltipItem<ChartType>, data: ChartData) => number;

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

/**
* Background color of the tooltip.
Expand Down Expand Up @@ -3041,7 +3041,7 @@ export type RadialLinearScaleOptions = CoreScaleOptions & {
* Padding of label backdrop.
* @default 2
*/
backdropPadding: Scriptable<number | ChartArea, ScriptableScaleContext>;
backdropPadding: Scriptable<number | ChartArea, ScriptableScaleContext>;

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

/**
* Callback function to transform data labels to point labels. The default implementation simply returns the current string.
* @default true
*/
callback: (label: string) => string;
callback: (label: string, index: number) => string;
};

/**
Expand Down

0 comments on commit 9293dda

Please sign in to comment.