]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Update ScriptableContext, reduce warnings (#8390)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Sat, 6 Feb 2021 00:59:55 +0000 (02:59 +0200)
committerGitHub <noreply@github.com>
Sat, 6 Feb 2021 00:59:55 +0000 (19:59 -0500)
* Update ScriptableContext, reduce warnings

* _parsed is unknown[]

* Add defaults

* static defaults.

* review update

* more cancelables

types/animation.d.ts
types/basic.d.ts [new file with mode: 0644]
types/helpers/helpers.core.d.ts
types/index.esm.d.ts

index e383e829fee269cc6b6052c274e43699175f6040..9f78e06c9c1230c08bfd38976316bdc9fa27bfdb 100644 (file)
@@ -1,9 +1,10 @@
 import { Chart } from './index.esm';
+import { AnyObject } from './basic';
 
 export class Animation {
-       constructor(cfg: any, target: any, prop: string, to?: any);
+       constructor(cfg: AnyObject, target: AnyObject, prop: string, to?: unknown);
        active(): boolean;
-       update(cfg: any, to: any, date: number): void;
+       update(cfg: AnyObject, to: unknown, date: number): void;
        cancel(): void;
        tick(date: number): void;
 }
@@ -25,7 +26,7 @@ export class Animator {
 }
 
 export class Animations {
-       constructor(chart: Chart, animations: {});
-       configure(animations: {}): void;
-       update(target: any, values: any): undefined | boolean;
+       constructor(chart: Chart, animations: AnyObject);
+       configure(animations: AnyObject): void;
+       update(target: AnyObject, values: AnyObject): undefined | boolean;
 }
diff --git a/types/basic.d.ts b/types/basic.d.ts
new file mode 100644 (file)
index 0000000..1692c9c
--- /dev/null
@@ -0,0 +1,3 @@
+
+export type AnyObject = Record<string, unknown>;
+export type EmptyObject = Record<string, never>;
index d96f84b755d9859c8458604c403d96be0f2bc3bd..48beb6b42c9aa8fa983ccecf4255f0b4f3472c8e 100644 (file)
@@ -1,3 +1,5 @@
+import { AnyObject } from '../basic';
+
 /**
  * An empty function that can be used, for example, for optional callback.
  */
@@ -15,27 +17,27 @@ export function uid(): number;
  * @returns {boolean}
  * @since 2.7.0
  */
-export function isNullOrUndef(value: any): value is null | undefined;
+export function isNullOrUndef(value: unknown): value is null | undefined;
 /**
  * Returns true if `value` is an array (including typed arrays), else returns false.
  * @param {*} value - The value to test.
  * @returns {boolean}
  * @function
  */
-export function isArray<T = any>(value: any): value is ArrayLike<T>;
+export function isArray<T = unknown>(value: unknown): value is ArrayLike<T>;
 /**
  * Returns true if `value` is an object (excluding null), else returns false.
  * @param {*} value - The value to test.
  * @returns {boolean}
  * @since 2.7.0
  */
-export function isObject(value: any): value is object;
+export function isObject(value: unknown): value is AnyObject;
 /**
  * Returns true if `value` is a finite number, else returns false
  * @param {*} value - The value to test.
  * @returns {boolean}
  */
-export function isFinite(value: any): value is number;
+export function isFinite(value: unknown): value is number;
 /**
  * Returns `value` if defined, else returns `defaultValue`.
  * @param {*} value - The value to return if defined.
@@ -51,9 +53,9 @@ export function valueOrDefault<T>(value: T | undefined, defaultValue: T): T;
  * @param [thisArg] - The value of `this` provided for the call to `fn`.
  * @returns {*}
  */
-export function callback<T extends (this: TA, ...args: any[]) => R, TA, R>(
+export function callback<T extends (this: TA, ...args: unknown[]) => R, TA, R>(
        fn: T | undefined,
-       args: any[],
+       args: unknown[],
        thisArg?: TA
 ): R | undefined;
 
@@ -95,7 +97,7 @@ export function each<T, TA>(
 export function clone<T>(source: T): T;
 
 export interface MergeOptions {
-       merger?: (key: string, target: any, source: any, options: any) => any;
+       merger?: (key: string, target: AnyObject, source: AnyObject, options: AnyObject) => AnyObject;
 }
 /**
  * Recursively deep copies `source` properties into `target` with the given `options`.
@@ -116,7 +118,7 @@ export function merge<T, S1, S2, S3, S4>(
        source: [S1, S2, S3, S4],
        options?: MergeOptions
 ): T & S1 & S2 & S3 & S4;
-export function merge<T>(target: T, source: any[], options?: MergeOptions): any;
+export function merge<T>(target: T, source: AnyObject[], options?: MergeOptions): AnyObject;
 
 /**
  * Recursively deep copies `source` properties into `target` *only* if not defined in target.
@@ -131,6 +133,6 @@ export function mergeIf<T, S1>(target: T, source: [S1]): T & S1;
 export function mergeIf<T, S1, S2>(target: T, source: [S1, S2]): T & S1 & S2;
 export function mergeIf<T, S1, S2, S3>(target: T, source: [S1, S2, S3]): T & S1 & S2 & S3;
 export function mergeIf<T, S1, S2, S3, S4>(target: T, source: [S1, S2, S3, S4]): T & S1 & S2 & S3 & S4;
-export function mergeIf<T>(target: T, source: any[]): any;
+export function mergeIf<T>(target: T, source: AnyObject[]): AnyObject;
 
-export function resolveObjectKey(obj: any, key: string): any;
+export function resolveObjectKey(obj: AnyObject, key: string): AnyObject;
index c398b0f5f9133110823426637e762ee52fc98d21..200ec13790f3cc354b9d1b2ba5cf69f57521b08e 100644 (file)
@@ -14,6 +14,7 @@
 
 import { TimeUnit } from './adapters';
 import { AnimationEvent } from './animation';
+import { AnyObject, EmptyObject } from './basic';
 import { Color } from './color';
 import { Element } from './element';
 import { ChartArea, Point } from './geometric';
@@ -39,7 +40,8 @@ export {
 
 export interface ScriptableContext {
        chart: Chart;
-       dataPoint: any;
+       parsed: unknown[];
+       raw: unknown[];
        dataIndex: number;
        dataset: ChartDataset;
        datasetIndex: number;
@@ -140,7 +142,7 @@ export interface BarControllerChartOptions {
        skipNull?: boolean;
 }
 
-export interface BarController extends DatasetController {}
+export type BarController = DatasetController
 export const BarController: ChartComponent & {
        prototype: BarController;
        new (chart: Chart, datasetIndex: number): BarController;
@@ -168,7 +170,7 @@ export interface BubbleDataPoint {
        r: number;
 }
 
-export interface BubbleController extends DatasetController {}
+export type BubbleController = DatasetController
 export const BubbleController: ChartComponent & {
        prototype: BubbleController;
        new (chart: Chart, datasetIndex: number): BubbleController;
@@ -211,7 +213,7 @@ export interface LineControllerChartOptions {
        showLine: boolean;
 }
 
-export interface LineController extends DatasetController {}
+export type LineController = DatasetController
 export const LineController: ChartComponent & {
        prototype: LineController;
        new (chart: Chart, datasetIndex: number): LineController;
@@ -226,7 +228,7 @@ export interface ScatterDataPoint {
 
 export type ScatterControllerChartOptions = LineControllerChartOptions;
 
-export interface ScatterController extends LineController {}
+export type ScatterController = LineController
 export const ScatterController: ChartComponent & {
        prototype: ScatterController;
        new (chart: Chart, datasetIndex: number): ScatterController;
@@ -316,7 +318,7 @@ export type PieAnimationOptions = DoughnutAnimationOptions;
 
 export type PieDataPoint = DoughnutDataPoint;
 
-export interface PieController extends DoughnutController {}
+export type PieController = DoughnutController
 export const PieController: ChartComponent & {
        prototype: PieController;
        new (chart: Chart, datasetIndex: number): PieController;
@@ -378,7 +380,7 @@ export interface RadarControllerDatasetOptions
 
 export type RadarControllerChartOptions = LineControllerChartOptions;
 
-export interface RadarController extends DatasetController {}
+export type RadarController = DatasetController
 export const RadarController: ChartComponent & {
        prototype: RadarController;
        new (chart: Chart, datasetIndex: number): RadarController;
@@ -415,7 +417,7 @@ export interface ChartMeta<TElement extends Element = Element, TDatasetElement e
 
        _sorted: boolean;
        _stacked: boolean;
-       _parsed: any[];
+       _parsed: unknown[];
 }
 
 export interface ActiveDataPoint {
@@ -480,13 +482,14 @@ export declare class Chart<
        setActiveElements(active: ActiveDataPoint[]): void;
 
        destroy(): void;
-       toBase64Image(type?: string, quality?: any): string;
+       toBase64Image(type?: string, quality?: unknown): string;
        bindEvents(): void;
        unbindEvents(): void;
        updateHoverStyle(items: Element, mode: 'dataset', enabled: boolean): void;
 
        notifyPlugins(hook: string, args?: AnyObject): boolean | void;
 
+       static readonly defaults: Defaults;
        static readonly version: string;
        static readonly instances: { [key: string]: Chart };
        static readonly registry: Registry;
@@ -541,44 +544,44 @@ export class DatasetController<TElement extends Element = Element, TDatasetEleme
        addElements(): void;
        buildOrUpdateElements(resetNewElements?: boolean): void;
 
-       getStyle(index: number, active: boolean): any;
-       protected resolveDatasetElementOptions(active: boolean): any;
-       protected resolveDataElementOptions(index: number, mode: UpdateMode): any;
+       getStyle(index: number, active: boolean): AnyObject;
+       protected resolveDatasetElementOptions(active: boolean): AnyObject;
+       protected resolveDataElementOptions(index: number, mode: UpdateMode): AnyObject;
        /**
         * Utility for checking if the options are shared and should be animated separately.
         * @protected
         */
-       protected getSharedOptions(options: any): undefined | any;
+       protected getSharedOptions(options: AnyObject): undefined | AnyObject;
        /**
         * Utility for determining if `options` should be included in the updated properties
         * @protected
         */
-       protected includeOptions(mode: UpdateMode, sharedOptions: any): boolean;
+       protected includeOptions(mode: UpdateMode, sharedOptions: AnyObject): boolean;
        /**
         * Utility for updating an element with new properties, using animations when appropriate.
         * @protected
         */
 
-       protected updateElement(element: TElement | TDatasetElement, index: number | undefined, properties: any, mode: UpdateMode): void;
+       protected updateElement(element: TElement | TDatasetElement, index: number | undefined, properties: AnyObject, mode: UpdateMode): void;
        /**
         * Utility to animate the shared options, that are potentially affecting multiple elements.
         * @protected
         */
 
-       protected updateSharedOptions(sharedOptions: any, mode: UpdateMode, newOptions: any): void;
+       protected updateSharedOptions(sharedOptions: AnyObject, mode: UpdateMode, newOptions: AnyObject): void;
        removeHoverStyle(element: TElement, datasetIndex: number, index: number): void;
        setHoverStyle(element: TElement, datasetIndex: number, index: number): void;
 
        parse(start: number, count: number): void;
-       protected parsePrimitiveData(meta: ChartMeta<TElement, TDatasetElement>, data: any[], start: number, count: number): any[];
-       protected parseArrayData(meta: ChartMeta<TElement, TDatasetElement>, data: any[], start: number, count: number): any[];
-       protected parseObjectData(meta: ChartMeta<TElement, TDatasetElement>, data: any[], start: number, count: number): any[];
-       protected getParsed(index: number): any;
-       protected applyStack(scale: Scale, parsed: any[]): number;
+       protected parsePrimitiveData(meta: ChartMeta<TElement, TDatasetElement>, data: AnyObject[], start: number, count: number): AnyObject[];
+       protected parseArrayData(meta: ChartMeta<TElement, TDatasetElement>, data: AnyObject[], start: number, count: number): AnyObject[];
+       protected parseObjectData(meta: ChartMeta<TElement, TDatasetElement>, data: AnyObject[], start: number, count: number): AnyObject[];
+       protected getParsed(index: number): AnyObject;
+       protected applyStack(scale: Scale, parsed: unknown[]): number;
        protected updateRangeFromParsed(
                range: { min: number; max: number },
                scale: Scale,
-               parsed: any[],
+               parsed: unknown[],
                stack: boolean
        ): void;
        protected getMinMax(scale: Scale, canStack?: boolean): { min: number; max: number };
@@ -593,7 +596,6 @@ export interface DatasetControllerChartComponent extends ChartComponent {
        };
 }
 
-export type AnyObject = Record<string, unknown>;
 export interface Defaults extends CoreChartOptions, ElementChartOptions, PluginChartOptions {
        controllers: {
                [key in ChartType]: DeepPartial<
@@ -729,7 +731,7 @@ export const layouts: {
        update(chart: Chart, width: number, height: number): void;
 };
 
-export interface Plugin<O = {}> extends ExtendedPlugin {
+export interface Plugin<O = AnyObject> extends ExtendedPlugin {
        id: string;
 
        /**
@@ -739,7 +741,7 @@ export interface Plugin<O = {}> extends ExtendedPlugin {
         * @param {object} options - The plugin options.
         * @since 3.0.0
         */
-       install?(chart: Chart, args: {}, options: O): void;
+       install?(chart: Chart, args: EmptyObject, options: O): void;
        /**
         * @desc Called when a plugin is starting. This happens when chart is created or plugin is enabled.
         * @param {Chart} chart - The chart instance.
@@ -747,7 +749,7 @@ export interface Plugin<O = {}> extends ExtendedPlugin {
         * @param {object} options - The plugin options.
         * @since 3.0.0
         */
-       start?(chart: Chart, args: {}, options: O): void;
+       start?(chart: Chart, args: EmptyObject, options: O): void;
        /**
         * @desc Called when a plugin stopping. This happens when chart is destroyed or plugin is disabled.
         * @param {Chart} chart - The chart instance.
@@ -755,21 +757,21 @@ export interface Plugin<O = {}> extends ExtendedPlugin {
         * @param {object} options - The plugin options.
         * @since 3.0.0
         */
-       stop?(chart: Chart, args: {}, options: O): void;
+       stop?(chart: Chart, args: EmptyObject, options: O): void;
        /**
         * @desc Called before initializing `chart`.
         * @param {Chart} chart - The chart instance.
         * @param {object} args - The call arguments.
         * @param {object} options - The plugin options.
         */
-       beforeInit?(chart: Chart, args: {}, options: O): void;
+       beforeInit?(chart: Chart, args: EmptyObject, options: O): void;
        /**
         * @desc Called after `chart` has been initialized and before the first update.
         * @param {Chart} chart - The chart instance.
         * @param {object} args - The call arguments.
         * @param {object} options - The plugin options.
         */
-       afterInit?(chart: Chart, args: {}, options: O): void;
+       afterInit?(chart: Chart, args: EmptyObject, options: O): void;
        /**
         * @desc Called before updating `chart`. If any plugin returns `false`, the update
         * is cancelled (and thus subsequent render(s)) until another `update` is triggered.
@@ -779,7 +781,7 @@ export interface Plugin<O = {}> extends ExtendedPlugin {
         * @param {object} options - The plugin options.
         * @returns {boolean} `false` to cancel the chart update.
         */
-       beforeUpdate?(chart: Chart, args: { mode: UpdateMode }, options: O): boolean | void;
+       beforeUpdate?(chart: Chart, args: { mode: UpdateMode, cancelable: true }, options: O): boolean | void;
        /**
         * @desc Called after `chart` has been updated and before rendering. Note that this
         * hook will not be called if the chart update has been previously cancelled.
@@ -796,7 +798,7 @@ export interface Plugin<O = {}> extends ExtendedPlugin {
         * @param {object} args - The call arguments.
         * @param {object} options - The plugin options.
         */
-       beforeElementsUpdate?(chart: Chart, args: {}, options: O): void;
+       beforeElementsUpdate?(chart: Chart, args: EmptyObject, options: O): void;
        /**
         * @desc Called during chart reset
         * @param {Chart} chart - The chart instance.
@@ -804,7 +806,7 @@ export interface Plugin<O = {}> extends ExtendedPlugin {
         * @param {object} options - The plugin options.
         * @since version 3.0.0
         */
-       reset?(chart: Chart, args: {}, options: O): void;
+       reset?(chart: Chart, args: EmptyObject, options: O): void;
        /**
         * @desc Called before updating the `chart` datasets. If any plugin returns `false`,
         * the datasets update is cancelled until another `update` is triggered.
@@ -825,7 +827,7 @@ export interface Plugin<O = {}> extends ExtendedPlugin {
         * @param {object} options - The plugin options.
         * @since version 2.1.5
         */
-       afterDatasetsUpdate?(chart: Chart, args: { mode: UpdateMode }, options: O): void;
+       afterDatasetsUpdate?(chart: Chart, args: { mode: UpdateMode, cancelable: true }, options: O): void;
        /**
         * @desc Called before updating the `chart` dataset at the given `args.index`. If any plugin
         * returns `false`, the datasets update is cancelled until another `update` is triggered.
@@ -837,7 +839,7 @@ export interface Plugin<O = {}> extends ExtendedPlugin {
         * @param {object} options - The plugin options.
         * @returns {boolean} `false` to cancel the chart datasets drawing.
         */
-       beforeDatasetUpdate?(chart: Chart, args: { index: number; meta: ChartMeta, mode: UpdateMode }, options: O): boolean | void;
+       beforeDatasetUpdate?(chart: Chart, args: { index: number; meta: ChartMeta, mode: UpdateMode, cancelable: true }, options: O): boolean | void;
        /**
         * @desc Called after the `chart` datasets at the given `args.index` has been updated. Note
         * that this hook will not be called if the datasets update has been previously cancelled.
@@ -848,7 +850,7 @@ export interface Plugin<O = {}> extends ExtendedPlugin {
         * @param {UpdateMode} args.mode - The update mode.
         * @param {object} options - The plugin options.
         */
-       afterDatasetUpdate?(chart: Chart, args: { index: number; meta: ChartMeta, mode: UpdateMode }, options: O): void;
+       afterDatasetUpdate?(chart: Chart, args: { index: number; meta: ChartMeta, mode: UpdateMode, cancelable: false }, options: O): void;
        /**
         * @desc Called before laying out `chart`. If any plugin returns `false`,
         * the layout update is cancelled until another `update` is triggered.
@@ -857,7 +859,7 @@ export interface Plugin<O = {}> extends ExtendedPlugin {
         * @param {object} options - The plugin options.
         * @returns {boolean} `false` to cancel the chart layout.
         */
-       beforeLayout?(chart: Chart, args: {}, options: O): boolean | void;
+       beforeLayout?(chart: Chart, args: { cancelable: true }, options: O): boolean | void;
        /**
         * @desc Called before scale data limits are calculated. This hook is called separately for each scale in the chart.
         * @param {Chart} chart - The chart instance.
@@ -897,7 +899,7 @@ export interface Plugin<O = {}> extends ExtendedPlugin {
         * @param {object} args - The call arguments.
         * @param {object} options - The plugin options.
         */
-       afterLayout?(chart: Chart, args: {}, options: O): void;
+       afterLayout?(chart: Chart, args: EmptyObject, options: O): void;
        /**
         * @desc Called before rendering `chart`. If any plugin returns `false`,
         * the rendering is cancelled until another `render` is triggered.
@@ -906,7 +908,7 @@ export interface Plugin<O = {}> extends ExtendedPlugin {
         * @param {object} options - The plugin options.
         * @returns {boolean} `false` to cancel the chart rendering.
         */
-       beforeRender?(chart: Chart, args: {}, options: O): boolean | void;
+       beforeRender?(chart: Chart, args: { cancelable: true }, options: O): boolean | void;
        /**
         * @desc Called after the `chart` has been fully rendered (and animation completed). Note
         * that this hook will not be called if the rendering has been previously cancelled.
@@ -914,7 +916,7 @@ export interface Plugin<O = {}> extends ExtendedPlugin {
         * @param {object} args - The call arguments.
         * @param {object} options - The plugin options.
         */
-       afterRender?(chart: Chart, args: {}, options: O): void;
+       afterRender?(chart: Chart, args: EmptyObject, options: O): void;
        /**
         * @desc Called before drawing `chart` at every animation frame. If any plugin returns `false`,
         * the frame drawing is cancelled untilanother `render` is triggered.
@@ -923,7 +925,7 @@ export interface Plugin<O = {}> extends ExtendedPlugin {
         * @param {object} options - The plugin options.
         * @returns {boolean} `false` to cancel the chart drawing.
         */
-       beforeDraw?(chart: Chart, args: {}, options: O): boolean | void;
+       beforeDraw?(chart: Chart, args: { cancelable: true }, options: O): boolean | void;
        /**
         * @desc Called after the `chart` has been drawn. Note that this hook will not be called
         * if the drawing has been previously cancelled.
@@ -931,7 +933,7 @@ export interface Plugin<O = {}> extends ExtendedPlugin {
         * @param {object} args - The call arguments.
         * @param {object} options - The plugin options.
         */
-       afterDraw?(chart: Chart, args: {}, options: O): void;
+       afterDraw?(chart: Chart, args: EmptyObject, options: O): void;
        /**
         * @desc Called before drawing the `chart` datasets. If any plugin returns `false`,
         * the datasets drawing is cancelled until another `render` is triggered.
@@ -940,7 +942,7 @@ export interface Plugin<O = {}> extends ExtendedPlugin {
         * @param {object} options - The plugin options.
         * @returns {boolean} `false` to cancel the chart datasets drawing.
         */
-       beforeDatasetsDraw?(chart: Chart, args: {}, options: O): boolean | void;
+       beforeDatasetsDraw?(chart: Chart, args: { cancelable: true }, options: O): boolean | void;
        /**
         * @desc Called after the `chart` datasets have been drawn. Note that this hook
         * will not be called if the datasets drawing has been previously cancelled.
@@ -948,7 +950,7 @@ export interface Plugin<O = {}> extends ExtendedPlugin {
         * @param {object} args - The call arguments.
         * @param {object} options - The plugin options.
         */
-       afterDatasetsDraw?(chart: Chart, args: {}, options: O): void;
+       afterDatasetsDraw?(chart: Chart, args: EmptyObject, options: O, cancelable: false): void;
        /**
         * @desc Called before drawing the `chart` dataset at the given `args.index` (datasets
         * are drawn in the reverse order). If any plugin returns `false`, the datasets drawing
@@ -981,7 +983,7 @@ export interface Plugin<O = {}> extends ExtendedPlugin {
         * @param {boolean} args.replay - True if this event is replayed from `Chart.update`
         * @param {object} options - The plugin options.
         */
-       beforeEvent?(chart: Chart, args: { event: ChartEvent, replay: boolean }, options: O): boolean | void;
+       beforeEvent?(chart: Chart, args: { event: ChartEvent, replay: boolean, cancelable: true }, options: O): boolean | void;
        /**
         * @desc Called after the `event` has been consumed. Note that this hook
         * will not be called if the `event` has been previously discarded.
@@ -992,7 +994,7 @@ export interface Plugin<O = {}> extends ExtendedPlugin {
         * @param {boolean} [args.changed] - Set to true if the plugin needs a render. Should only be changed to true, because this args object is passed through all plugins.
         * @param {object} options - The plugin options.
         */
-       afterEvent?(chart: Chart, args: { event: ChartEvent, replay: boolean, changed?: boolean }, options: O): void;
+       afterEvent?(chart: Chart, args: { event: ChartEvent, replay: boolean, changed?: boolean, cancelable: false }, options: O): void;
        /**
         * @desc Called after the chart as been resized.
         * @param {Chart} chart - The chart instance.
@@ -1007,7 +1009,7 @@ export interface Plugin<O = {}> extends ExtendedPlugin {
         * @param {object} args - The call arguments.
         * @param {object} options - The plugin options.
         */
-       destroy?(chart: Chart, args: {}, options: O): void;
+       destroy?(chart: Chart, args: EmptyObject, options: O): void;
        /**
         * Called after chart is destroyed on all plugins that were installed for that chart. This hook is also invoked for disabled plugins (options === false).
         * @param {Chart} chart - The chart instance.
@@ -1015,7 +1017,7 @@ export interface Plugin<O = {}> extends ExtendedPlugin {
         * @param {object} options - The plugin options.
         * @since 3.0.0
         */
-       uninstall?(chart: Chart, args: {}, options: O): void;
+       uninstall?(chart: Chart, args: EmptyObject, options: O): void;
 }
 
 export declare type ChartComponentLike = ChartComponent | ChartComponent[] | { [key: string]: ChartComponent };
@@ -1202,7 +1204,7 @@ export interface Scale<O extends CoreScaleOptions = CoreScaleOptions> extends El
        getBasePixel(): number;
 
        init(options: O): void;
-       parse(raw: any, index: number): any;
+       parse(raw: unknown, index: number): unknown;
        getUserBounds(): { min: number; max: number; minDefined: boolean; maxDefined: boolean };
        getMinMax(canStack: boolean): { min: number; max: number };
        getTicks(): Tick[];
@@ -1233,7 +1235,7 @@ export interface Scale<O extends CoreScaleOptions = CoreScaleOptions> extends El
 }
 export const Scale: {
        prototype: Scale;
-       new <O extends CoreScaleOptions = CoreScaleOptions>(cfg: any): Scale<O>;
+       new <O extends CoreScaleOptions = CoreScaleOptions>(cfg: AnyObject): Scale<O>;
 };
 
 export interface ScriptableScaleContext {
@@ -1250,7 +1252,7 @@ export const Ticks: {
                 * @param value the value to display
                 * @return {string|string[]} the label to display
                 */
-               values(value: any): string | string[];
+               values(value: unknown): string | string[];
                /**
                 * Formatter for numeric ticks
                 * @param tickValue the value to be formatted
@@ -1300,7 +1302,7 @@ export interface ChartEvent {
 }
 export interface ChartComponent {
        id: string;
-       defaults?: any;
+       defaults?: AnyObject;
        defaultRoutes?: { [property: string]: string };
 
        beforeRegister?(): void;
@@ -1618,7 +1620,7 @@ export interface ArcElement<T extends ArcProps = ArcProps, O extends ArcOptions
 
 export const ArcElement: ChartComponent & {
        prototype: ArcElement;
-       new (cfg: any): ArcElement;
+       new (cfg: AnyObject): ArcElement;
 };
 
 export interface LineProps {}
@@ -1682,13 +1684,13 @@ export interface LineElement<T extends LineProps = LineProps, O extends LineOpti
        first(): Point | false;
        last(): Point | false;
        interpolate(point: Point, property: 'x' | 'y'): undefined | Point | Point[];
-       pathSegment(ctx: CanvasRenderingContext2D, segment: Segment, params: any): undefined | boolean;
+       pathSegment(ctx: CanvasRenderingContext2D, segment: Segment, params: AnyObject): undefined | boolean;
        path(ctx: CanvasRenderingContext2D): boolean;
 }
 
 export const LineElement: ChartComponent & {
        prototype: LineElement;
-       new (cfg: any): LineElement;
+       new (cfg: AnyObject): LineElement;
 };
 
 export interface PointProps {
@@ -1799,7 +1801,7 @@ export interface PointElement<T extends PointProps = PointProps, O extends Point
 
 export const PointElement: ChartComponent & {
        prototype: PointElement;
-       new (cfg: any): PointElement;
+       new (cfg: AnyObject): PointElement;
 };
 
 export interface BarProps {
@@ -1848,7 +1850,7 @@ export interface BarElement<
 
 export const BarElement: ChartComponent & {
        prototype: BarElement;
-       new (cfg: any): BarElement;
+       new (cfg: AnyObject): BarElement;
 };
 
 export interface ElementOptionsByType {
@@ -2470,7 +2472,12 @@ export interface TooltipItem {
        /**
         * Parsed data values for the given `dataIndex` and `datasetIndex`
         */
-       dataPoint: any;
+       parsed: unknown;
+
+       /**
+        * Raw data values for the given `dataIndex` and `datasetIndex`
+        */
+       raw: unknown;
 
        /**
         * Formatted value for the tooltip
@@ -2579,7 +2586,7 @@ export interface TickOptions {
        /**
         * Returns the string representation of the tick value as it should be displayed on the chart. See callback.
         */
-       callback: (tickValue: any, index: number, ticks: Tick[]) => string;
+       callback: (tickValue: unknown, index: number, ticks: Tick[]) => string;
        /**
         * If true, show tick labels.
         * @default true
@@ -2732,10 +2739,10 @@ export type CategoryScaleOptions = CartesianScaleOptions & {
        labels: string[] | string[][];
 };
 
-export interface CategoryScale<O extends CategoryScaleOptions = CategoryScaleOptions> extends Scale<O> {}
+export type CategoryScale<O extends CategoryScaleOptions = CategoryScaleOptions> = Scale<O>
 export const CategoryScale: ChartComponent & {
        prototype: CategoryScale;
-       new <O extends CategoryScaleOptions = CategoryScaleOptions>(cfg: any): CategoryScale<O>;
+       new <O extends CategoryScaleOptions = CategoryScaleOptions>(cfg: AnyObject): CategoryScale<O>;
 };
 
 export type LinearScaleOptions = CartesianScaleOptions & {
@@ -2781,10 +2788,10 @@ export type LinearScaleOptions = CartesianScaleOptions & {
        };
 };
 
-export interface LinearScale<O extends LinearScaleOptions = LinearScaleOptions> extends Scale<O> {}
+export type LinearScale<O extends LinearScaleOptions = LinearScaleOptions> = Scale<O>
 export const LinearScale: ChartComponent & {
        prototype: LinearScale;
-       new <O extends LinearScaleOptions = LinearScaleOptions>(cfg: any): LinearScale<O>;
+       new <O extends LinearScaleOptions = LinearScaleOptions>(cfg: AnyObject): LinearScale<O>;
 };
 
 export type LogarithmicScaleOptions = CartesianScaleOptions & {
@@ -2808,10 +2815,10 @@ export type LogarithmicScaleOptions = CartesianScaleOptions & {
        };
 };
 
-export interface LogarithmicScale<O extends LogarithmicScaleOptions = LogarithmicScaleOptions> extends Scale<O> {}
+export type LogarithmicScale<O extends LogarithmicScaleOptions = LogarithmicScaleOptions> = Scale<O>
 export const LogarithmicScale: ChartComponent & {
        prototype: LogarithmicScale;
-       new <O extends LogarithmicScaleOptions = LogarithmicScaleOptions>(cfg: any): LogarithmicScale<O>;
+       new <O extends LogarithmicScaleOptions = LogarithmicScaleOptions>(cfg: AnyObject): LogarithmicScale<O>;
 };
 
 export type TimeScaleOptions = CartesianScaleOptions & {
@@ -2829,7 +2836,7 @@ export type TimeScaleOptions = CartesianScaleOptions & {
         * options for creating a new adapter instance
         */
        adapters: {
-               date: any;
+               date: unknown;
        };
 
        time: {
@@ -2837,7 +2844,7 @@ export type TimeScaleOptions = CartesianScaleOptions & {
                 * Custom parser for dates.
                 * @see https://www.chartjs.org/docs/next/axes/cartesian/time#parser
                 */
-               parser: string | ((v: any) => number);
+               parser: string | ((v: unknown) => number);
                /**
                 * If defined, dates will be rounded to the start of this unit. See Time Units below for the allowed units.
                 */
@@ -2900,13 +2907,13 @@ export interface TimeScale<O extends TimeScaleOptions = TimeScaleOptions> extend
 
 export const TimeScale: ChartComponent & {
        prototype: TimeScale;
-       new <O extends TimeScaleOptions = TimeScaleOptions>(cfg: any): TimeScale<O>;
+       new <O extends TimeScaleOptions = TimeScaleOptions>(cfg: AnyObject): TimeScale<O>;
 };
 
-export interface TimeSeriesScale<O extends TimeScaleOptions = TimeScaleOptions> extends TimeScale<O> {}
+export type TimeSeriesScale<O extends TimeScaleOptions = TimeScaleOptions> = TimeScale<O>
 export const TimeSeriesScale: ChartComponent & {
        prototype: TimeSeriesScale;
-       new <O extends TimeScaleOptions = TimeScaleOptions>(cfg: any): TimeSeriesScale<O>;
+       new <O extends TimeScaleOptions = TimeScaleOptions>(cfg: AnyObject): TimeSeriesScale<O>;
 };
 
 export type RadialLinearScaleOptions = CoreScaleOptions & {
@@ -3046,7 +3053,7 @@ export interface RadialLinearScale<O extends RadialLinearScaleOptions = RadialLi
 }
 export const RadialLinearScale: ChartComponent & {
        prototype: RadialLinearScale;
-       new <O extends RadialLinearScaleOptions = RadialLinearScaleOptions>(cfg: any): RadialLinearScale<O>;
+       new <O extends RadialLinearScaleOptions = RadialLinearScaleOptions>(cfg: AnyObject): RadialLinearScale<O>;
 };
 
 // DeepPartial implementation taken from the utility-types NPM package, which is
@@ -3059,7 +3066,7 @@ export type DeepPartial<T> = T extends Function
        : T extends object
        ? _DeepPartialObject<T>
        : T | undefined;
-       interface _DeepPartialArray<T> extends Array<DeepPartial<T>> {}
+       type _DeepPartialArray<T> = Array<DeepPartial<T>>
        type _DeepPartialObject<T> = { [P in keyof T]?: DeepPartial<T[P]> };
 
 export type DistributiveArray<T> = T extends unknown ? T[] : never
@@ -3113,7 +3120,7 @@ export interface ChartTypeRegistry {
                scales: keyof CartesianScaleTypeRegistry;
        };
        bubble: {
-               chartOptions: {};
+               chartOptions: EmptyObject;
                datasetOptions: BubbleControllerDatasetOptions;
                defaultDataPoint: BubbleDataPoint;
                scales: keyof CartesianScaleTypeRegistry;