From: Josh Kelley Date: Thu, 25 Mar 2021 15:09:01 +0000 (-0400) Subject: Minor type fixes (#8719) X-Git-Tag: v3.0.0-rc.4~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9293dda4a731f66bcdce9e999e5d6f9d35461f37;p=thirdparty%2FChart.js.git 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 --- diff --git a/types/index.esm.d.ts b/types/index.esm.d.ts index 6f34f731d..3fb3ea3b7 100644 --- a/types/index.esm.d.ts +++ b/types/index.esm.d.ts @@ -2370,9 +2370,9 @@ export interface TooltipOptions extends CoreInteraction /** * Sort tooltip items. */ - itemSort: (a: TooltipItem, b: TooltipItem) => number; + itemSort: (a: TooltipItem, b: TooltipItem, data: ChartData) => number; - filter: (e: TooltipItem) => boolean; + filter: (e: TooltipItem, index: number, array: TooltipItem[], data: ChartData) => boolean; /** * Background color of the tooltip. @@ -3041,7 +3041,7 @@ export type RadialLinearScaleOptions = CoreScaleOptions & { * Padding of label backdrop. * @default 2 */ - backdropPadding: Scriptable; + backdropPadding: Scriptable; /** * if true, point labels are shown. @@ -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; }; /**