Skip to content

Commit

Permalink
Correct type for updateHoverStyle (#10131)
Browse files Browse the repository at this point in the history
* Correct type for updateHoverStyle
* Lint fixes
  • Loading branch information
etimberg committed Feb 5, 2022
1 parent 49dc77e commit 2995775
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion types/index.esm.d.ts
Expand Up @@ -529,7 +529,7 @@ export declare class Chart<
toBase64Image(type?: string, quality?: unknown): string;
bindEvents(): void;
unbindEvents(): void;
updateHoverStyle(items: Element, mode: 'dataset', enabled: boolean): void;
updateHoverStyle(items: InteractionItem[], mode: 'dataset', enabled: boolean): void;

notifyPlugins(hook: string, args?: AnyObject): boolean | void;

Expand Down
17 changes: 17 additions & 0 deletions types/tests/interaction.ts
@@ -0,0 +1,17 @@
import {
Chart, ChartData, ChartConfiguration, Element
} from '../index.esm';

const data: ChartData<'line'> = { datasets: [] };
const chartItem = 'item';
const config: ChartConfiguration<'line'> = { type: 'line', data };
const chart: Chart = new Chart(chartItem, config);

type Item = {
element: Element,
datasetIndex: number,
index: number
}

const elements: Item[] = [];
chart.updateHoverStyle(elements, 'dataset', true);

0 comments on commit 2995775

Please sign in to comment.