From afd80205b19c54dfb5cf2e16111e1fe0f1eb6511 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Sun, 13 Sep 2026 10:03:00 +0200 Subject: [PATCH] chore: clean up mixed Chartist imports (#2) --- CHANGELOG.md | 7 +++++++ src/scripts/chartist-plugin-tooltip.ts | 9 ++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5a02fa..106e762 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [unreleased] + +### Changed +- Clean up mixed Chartist imports + +---- + ## [2.0.0] - 18th April 2026 ### Changed diff --git a/src/scripts/chartist-plugin-tooltip.ts b/src/scripts/chartist-plugin-tooltip.ts index f3ff037..16d967e 100644 --- a/src/scripts/chartist-plugin-tooltip.ts +++ b/src/scripts/chartist-plugin-tooltip.ts @@ -1,5 +1,4 @@ -import * as Chartist from 'chartist'; -import {BarChart, BaseChart, PieChart, PieChartOptions} from 'chartist'; +import {extend, BarChart, BaseChart, PieChart, PieChartOptions} from 'chartist'; /** * Tooltip plugin options. @@ -62,7 +61,7 @@ export default function ChartistPluginTooltip>( chart: T, options?: Partial ): void { - const defaultOptions = { + const defaultOptions: Options = { tooltipOffset: { x: 0, y: -20 @@ -76,7 +75,7 @@ export default function ChartistPluginTooltip>( metaIsHTML: false }; - const $options = Chartist.extend({}, defaultOptions, options) as Options; + const $options: Options = extend({}, defaultOptions, options); // Warning: If you are using npm link or yarn link, these instanceof checks will fail and you won't get any tooltips let tooltipSelector = $options.pointClass || ''; @@ -132,7 +131,7 @@ export default function ChartistPluginTooltip>( let tooltipText = ''; let seriesName = ''; - if (chart instanceof Chartist.BarChart) { + if (chart instanceof BarChart) { seriesName = (point.parentNode as HTMLElement).getAttribute('ct:meta') || (point.parentNode as HTMLElement).getAttribute('ct:series-name') ||