From: Jukka Kurkela Date: Thu, 11 Nov 2021 20:00:52 +0000 (+0200) Subject: Fix type linting and indent errors (#9843) X-Git-Tag: v3.6.1~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2988a6c6dcb582e29ab96b3947cf2565a97da261;p=thirdparty%2FChart.js.git Fix type linting and indent errors (#9843) * Fix type linting and indent errors * Properly indent comments too --- diff --git a/types/.eslintrc.yml b/types/.eslintrc.yml index ea2c5e417..14f736c75 100644 --- a/types/.eslintrc.yml +++ b/types/.eslintrc.yml @@ -10,6 +10,8 @@ extends: rules: # Replace stock eslint rules with typescript-eslint equivalents for proper # TypeScript support. + indent: "off" + "@typescript-eslint/indent": ["error", 2] no-use-before-define: "off" '@typescript-eslint/no-use-before-define': "error" no-shadow: "off" diff --git a/types/adapters.d.ts b/types/adapters.d.ts index 120598a16..f06c41b68 100644 --- a/types/adapters.d.ts +++ b/types/adapters.d.ts @@ -1,63 +1,63 @@ export type TimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year'; export interface DateAdapter { - // Override one or multiple of the methods to adjust to the logic of the current date library. - override(members: Partial): void; - readonly options: unknown; + // Override one or multiple of the methods to adjust to the logic of the current date library. + override(members: Partial): void; + readonly options: unknown; - /** - * Returns a map of time formats for the supported formatting units defined - * in Unit as well as 'datetime' representing a detailed date/time string. - * @returns {{string: string}} - */ - formats(): { [key: string]: string }; - /** - * Parses the given `value` and return the associated timestamp. - * @param {unknown} value - the value to parse (usually comes from the data) - * @param {string} [format] - the expected data format - */ - parse(value: unknown, format?: TimeUnit): number | null; - /** - * Returns the formatted date in the specified `format` for a given `timestamp`. - * @param {number} timestamp - the timestamp to format - * @param {string} format - the date/time token - * @return {string} - */ - format(timestamp: number, format: TimeUnit): string; - /** - * Adds the specified `amount` of `unit` to the given `timestamp`. - * @param {number} timestamp - the input timestamp - * @param {number} amount - the amount to add - * @param {Unit} unit - the unit as string - * @return {number} - */ - add(timestamp: number, amount: number, unit: TimeUnit): number; - /** - * Returns the number of `unit` between the given timestamps. - * @param {number} a - the input timestamp (reference) - * @param {number} b - the timestamp to subtract - * @param {Unit} unit - the unit as string - * @return {number} - */ - diff(a: number, b: number, unit: TimeUnit): number; - /** - * Returns start of `unit` for the given `timestamp`. - * @param {number} timestamp - the input timestamp - * @param {Unit|'isoWeek'} unit - the unit as string - * @param {number} [weekday] - the ISO day of the week with 1 being Monday - * and 7 being Sunday (only needed if param *unit* is `isoWeek`). - * @return {number} - */ - startOf(timestamp: number, unit: TimeUnit | 'isoWeek', weekday?: number): number; - /** - * Returns end of `unit` for the given `timestamp`. - * @param {number} timestamp - the input timestamp - * @param {Unit|'isoWeek'} unit - the unit as string - * @return {number} - */ - endOf(timestamp: number, unit: TimeUnit | 'isoWeek'): number; + /** + * Returns a map of time formats for the supported formatting units defined + * in Unit as well as 'datetime' representing a detailed date/time string. + * @returns {{string: string}} + */ + formats(): { [key: string]: string }; + /** + * Parses the given `value` and return the associated timestamp. + * @param {unknown} value - the value to parse (usually comes from the data) + * @param {string} [format] - the expected data format + */ + parse(value: unknown, format?: TimeUnit): number | null; + /** + * Returns the formatted date in the specified `format` for a given `timestamp`. + * @param {number} timestamp - the timestamp to format + * @param {string} format - the date/time token + * @return {string} + */ + format(timestamp: number, format: TimeUnit): string; + /** + * Adds the specified `amount` of `unit` to the given `timestamp`. + * @param {number} timestamp - the input timestamp + * @param {number} amount - the amount to add + * @param {Unit} unit - the unit as string + * @return {number} + */ + add(timestamp: number, amount: number, unit: TimeUnit): number; + /** + * Returns the number of `unit` between the given timestamps. + * @param {number} a - the input timestamp (reference) + * @param {number} b - the timestamp to subtract + * @param {Unit} unit - the unit as string + * @return {number} + */ + diff(a: number, b: number, unit: TimeUnit): number; + /** + * Returns start of `unit` for the given `timestamp`. + * @param {number} timestamp - the input timestamp + * @param {Unit|'isoWeek'} unit - the unit as string + * @param {number} [weekday] - the ISO day of the week with 1 being Monday + * and 7 being Sunday (only needed if param *unit* is `isoWeek`). + * @return {number} + */ + startOf(timestamp: number, unit: TimeUnit | 'isoWeek', weekday?: number): number; + /** + * Returns end of `unit` for the given `timestamp`. + * @param {number} timestamp - the input timestamp + * @param {Unit|'isoWeek'} unit - the unit as string + * @return {number} + */ + endOf(timestamp: number, unit: TimeUnit | 'isoWeek'): number; } export const _adapters: { - _date: DateAdapter; + _date: DateAdapter; }; diff --git a/types/animation.d.ts b/types/animation.d.ts index 07d3bb37c..b83204124 100644 --- a/types/animation.d.ts +++ b/types/animation.d.ts @@ -10,10 +10,10 @@ export class Animation { } export interface AnimationEvent { - chart: Chart; - numSteps: number; - initial: boolean; - currentStep: number; + chart: Chart; + numSteps: number; + initial: boolean; + currentStep: number; } export class Animator { diff --git a/types/element.d.ts b/types/element.d.ts index 09e330182..3b9359b3a 100644 --- a/types/element.d.ts +++ b/types/element.d.ts @@ -2,16 +2,16 @@ import { AnyObject } from './basic'; import { Point } from './geometric'; export interface Element { - readonly x: number; - readonly y: number; - readonly active: boolean; - readonly options: O; + readonly x: number; + readonly y: number; + readonly active: boolean; + readonly options: O; - tooltipPosition(useFinalPosition?: boolean): Point; - hasValue(): boolean; - getProps

(props: P, final?: boolean): Pick; + tooltipPosition(useFinalPosition?: boolean): Point; + hasValue(): boolean; + getProps

(props: P, final?: boolean): Pick; } export const Element: { - prototype: Element; - new (): Element; + prototype: Element; + new (): Element; }; diff --git a/types/helpers/helpers.canvas.d.ts b/types/helpers/helpers.canvas.d.ts index 4018f2e99..44e570e65 100644 --- a/types/helpers/helpers.canvas.d.ts +++ b/types/helpers/helpers.canvas.d.ts @@ -10,10 +10,10 @@ export function clipArea(ctx: CanvasRenderingContext2D, area: ChartArea): void; export function unclipArea(ctx: CanvasRenderingContext2D): void; export interface DrawPointOptions { - pointStyle: PointStyle; - rotation?: number; - radius: number; - borderWidth: number; + pointStyle: PointStyle; + rotation?: number; + radius: number; + borderWidth: number; } export function drawPoint(ctx: CanvasRenderingContext2D, options: DrawPointOptions, x: number, y: number): void; @@ -26,76 +26,76 @@ export function drawPoint(ctx: CanvasRenderingContext2D, options: DrawPointOptio export function toFontString(font: { size: number; family: string; style?: string; weight?: string }): string | null; export interface RenderTextOpts { - /** - * The fill color of the text. If unset, the existing - * fillStyle property of the canvas is unchanged. - */ - color?: Color; - - /** - * The width of the strikethrough / underline - * @default 2 - */ - decorationWidth?: number; - - /** - * The max width of the text in pixels - */ - maxWidth?: number; - - /** - * A rotation to be applied to the canvas - * This is applied after the translation is applied - */ - rotation?: number; - - /** - * Apply a strikethrough effect to the text - */ - strikethrough?: boolean; - - /** - * The color of the text stroke. If unset, the existing - * strokeStyle property of the context is unchanged - */ - strokeColor?: Color; - - /** - * The text stroke width. If unset, the existing - * lineWidth property of the context is unchanged - */ - strokeWidth?: number; - - /** - * The text alignment to use. If unset, the existing - * textAlign property of the context is unchanged - */ - textAlign: CanvasTextAlign; - - /** - * The text baseline to use. If unset, the existing - * textBaseline property of the context is unchanged - */ - textBaseline: CanvasTextBaseline; - - /** - * If specified, a translation to apply to the context - */ - translation?: [number, number]; - - /** - * Underline the text - */ - underline?: boolean; + /** + * The fill color of the text. If unset, the existing + * fillStyle property of the canvas is unchanged. + */ + color?: Color; + + /** + * The width of the strikethrough / underline + * @default 2 + */ + decorationWidth?: number; + + /** + * The max width of the text in pixels + */ + maxWidth?: number; + + /** + * A rotation to be applied to the canvas + * This is applied after the translation is applied + */ + rotation?: number; + + /** + * Apply a strikethrough effect to the text + */ + strikethrough?: boolean; + + /** + * The color of the text stroke. If unset, the existing + * strokeStyle property of the context is unchanged + */ + strokeColor?: Color; + + /** + * The text stroke width. If unset, the existing + * lineWidth property of the context is unchanged + */ + strokeWidth?: number; + + /** + * The text alignment to use. If unset, the existing + * textAlign property of the context is unchanged + */ + textAlign: CanvasTextAlign; + + /** + * The text baseline to use. If unset, the existing + * textBaseline property of the context is unchanged + */ + textBaseline: CanvasTextBaseline; + + /** + * If specified, a translation to apply to the context + */ + translation?: [number, number]; + + /** + * Underline the text + */ + underline?: boolean; } export function renderText( - ctx: CanvasRenderingContext2D, - text: string | string[], - x: number, - y: number, - font: CanvasFontSpec, - opts?: RenderTextOpts + ctx: CanvasRenderingContext2D, + text: string | string[], + x: number, + y: number, + font: CanvasFontSpec, + opts?: RenderTextOpts ): void; export function addRoundedRectPath(ctx: CanvasRenderingContext2D, rect: RoundedRect): void; diff --git a/types/helpers/helpers.collection.d.ts b/types/helpers/helpers.collection.d.ts index a617a2b48..6a51597c9 100644 --- a/types/helpers/helpers.collection.d.ts +++ b/types/helpers/helpers.collection.d.ts @@ -1,9 +1,9 @@ export interface ArrayListener { - _onDataPush?(...item: T[]): void; - _onDataPop?(): void; - _onDataShift?(): void; - _onDataSplice?(index: number, deleteCount: number, ...items: T[]): void; - _onDataUnshift?(...item: T[]): void; + _onDataPush?(...item: T[]): void; + _onDataPop?(): void; + _onDataShift?(): void; + _onDataSplice?(index: number, deleteCount: number, ...items: T[]): void; + _onDataUnshift?(...item: T[]): void; } /** diff --git a/types/helpers/helpers.color.d.ts b/types/helpers/helpers.color.d.ts index 1e8c118e1..3cfc20ea7 100644 --- a/types/helpers/helpers.color.d.ts +++ b/types/helpers/helpers.color.d.ts @@ -1,31 +1,31 @@ export function color(value: CanvasGradient): CanvasGradient; export function color(value: CanvasPattern): CanvasPattern; export function color( - value: - | string - | { r: number; g: number; b: number; a: number } - | [number, number, number] - | [number, number, number, number] + value: + | string + | { r: number; g: number; b: number; a: number } + | [number, number, number] + | [number, number, number, number] ): ColorModel; export interface ColorModel { - rgbString(): string; - hexString(): string; - hslString(): string; - rgb: { r: number; g: number; b: number; a: number }; - valid: boolean; - mix(color: ColorModel, weight: number): this; - clone(): ColorModel; - alpha(a: number): ColorModel; - clearer(ration: number): ColorModel; - greyscale(): ColorModel; - opaquer(ratio: number): ColorModel; - negate(): ColorModel; - lighten(ratio: number): ColorModel; - darken(ratio: number): ColorModel; - saturate(ratio: number): ColorModel; - desaturate(ratio: number): ColorModel; - rotate(deg: number): this; + rgbString(): string; + hexString(): string; + hslString(): string; + rgb: { r: number; g: number; b: number; a: number }; + valid: boolean; + mix(color: ColorModel, weight: number): this; + clone(): ColorModel; + alpha(a: number): ColorModel; + clearer(ration: number): ColorModel; + greyscale(): ColorModel; + opaquer(ratio: number): ColorModel; + negate(): ColorModel; + lighten(ratio: number): ColorModel; + darken(ratio: number): ColorModel; + saturate(ratio: number): ColorModel; + desaturate(ratio: number): ColorModel; + rotate(deg: number): this; } export function getHoverColor(value: CanvasGradient): CanvasGradient; diff --git a/types/helpers/helpers.core.d.ts b/types/helpers/helpers.core.d.ts index a973b362c..bc376da02 100644 --- a/types/helpers/helpers.core.d.ts +++ b/types/helpers/helpers.core.d.ts @@ -67,9 +67,9 @@ export function toDimension(value: number | string, dimension: number): number; * @returns {*} */ export function callback R, TA, R>( - fn: T | undefined, - args: unknown[], - thisArg?: TA + fn: T | undefined, + args: unknown[], + thisArg?: TA ): R | undefined; /** @@ -82,10 +82,10 @@ export function callback R, TA, R>( * @param [reverse] - If true, iterates backward on the loopable. */ export function each( - loopable: T[], - fn: (this: TA, v: T, i: number) => void, - thisArg?: TA, - reverse?: boolean + loopable: T[], + fn: (this: TA, v: T, i: number) => void, + thisArg?: TA, + reverse?: boolean ): void; /** * Note(SB) for performance sake, this method should only be used when loopable type @@ -97,10 +97,10 @@ export function each( * @param [reverse] - If true, iterates backward on the loopable. */ export function each( - loopable: { [key: string]: T }, - fn: (this: TA, v: T, k: string) => void, - thisArg?: TA, - reverse?: boolean + loopable: { [key: string]: T }, + fn: (this: TA, v: T, k: string) => void, + thisArg?: TA, + reverse?: boolean ): void; /** @@ -110,7 +110,7 @@ export function each( export function clone(source: T): T; export interface MergeOptions { - merger?: (key: string, target: AnyObject, source: AnyObject, options: AnyObject) => AnyObject; + merger?: (key: string, target: AnyObject, source: AnyObject, options: AnyObject) => AnyObject; } /** * Recursively deep copies `source` properties into `target` with the given `options`. @@ -127,9 +127,9 @@ export function merge(target: T, source: [S1], options?: MergeOptions): T export function merge(target: T, source: [S1, S2], options?: MergeOptions): T & S1 & S2; export function merge(target: T, source: [S1, S2, S3], options?: MergeOptions): T & S1 & S2 & S3; export function merge( - target: T, - source: [S1, S2, S3, S4], - options?: MergeOptions + target: T, + source: [S1, S2, S3, S4], + options?: MergeOptions ): T & S1 & S2 & S3 & S4; export function merge(target: T, source: AnyObject[], options?: MergeOptions): AnyObject; diff --git a/types/helpers/helpers.curve.d.ts b/types/helpers/helpers.curve.d.ts index d845e1579..28d9ee4a6 100644 --- a/types/helpers/helpers.curve.d.ts +++ b/types/helpers/helpers.curve.d.ts @@ -1,6 +1,6 @@ export interface SplinePoint { - x: number; - y: number; + x: number; + y: number; } /** @@ -8,21 +8,21 @@ export interface SplinePoint { * http://scaledinnovation.com/analytics/splines/aboutSplines.html */ export function splineCurve( - firstPoint: SplinePoint & { skip?: boolean }, - middlePoint: SplinePoint, - afterPoint: SplinePoint, - t: number + firstPoint: SplinePoint & { skip?: boolean }, + middlePoint: SplinePoint, + afterPoint: SplinePoint, + t: number ): { - previous: SplinePoint; - next: SplinePoint; + previous: SplinePoint; + next: SplinePoint; }; export interface MonotoneSplinePoint extends SplinePoint { - skip: boolean; - cp1x?: number; - cp1y?: number; - cp2x?: number; - cp2y?: number; + skip: boolean; + cp1x?: number; + cp1y?: number; + cp2x?: number; + cp2y?: number; } /** diff --git a/types/helpers/helpers.dom.d.ts b/types/helpers/helpers.dom.d.ts index a0f484a33..738643140 100644 --- a/types/helpers/helpers.dom.d.ts +++ b/types/helpers/helpers.dom.d.ts @@ -2,18 +2,18 @@ import { ChartEvent } from '../index.esm'; export function getMaximumSize(node: HTMLElement, width?: number, height?: number, aspectRatio?: number): { width: number, height: number }; export function getRelativePosition( - evt: MouseEvent | ChartEvent, - chart: { readonly canvas: HTMLCanvasElement } + evt: MouseEvent | ChartEvent, + chart: { readonly canvas: HTMLCanvasElement } ): { x: number; y: number }; export function getStyle(el: HTMLElement, property: string): string; export function retinaScale( - chart: { - currentDevicePixelRatio: number; - readonly canvas: HTMLCanvasElement; - readonly width: number; - readonly height: number; - readonly ctx: CanvasRenderingContext2D; - }, + chart: { + currentDevicePixelRatio: number; + readonly canvas: HTMLCanvasElement; + readonly width: number; + readonly height: number; + readonly ctx: CanvasRenderingContext2D; + }, forceRatio: number, forceStyle?: boolean ): void; diff --git a/types/helpers/helpers.math.d.ts b/types/helpers/helpers.math.d.ts index 3e0e9b8da..cc58b30e7 100644 --- a/types/helpers/helpers.math.d.ts +++ b/types/helpers/helpers.math.d.ts @@ -10,8 +10,8 @@ export function toDegrees(radians: number): number; * Gets the angle from vertical upright to the point about a centre. */ export function getAngleFromPoint( - centrePoint: { x: number; y: number }, - anglePoint: { x: number; y: number } + centrePoint: { x: number; y: number }, + anglePoint: { x: number; y: number } ): { angle: number; distance: number }; export function distanceBetweenPoints(pt1: { x: number; y: number }, pt2: { x: number; y: number }): number; diff --git a/types/helpers/helpers.options.d.ts b/types/helpers/helpers.options.d.ts index a6ff051b5..0bd783fa9 100644 --- a/types/helpers/helpers.options.d.ts +++ b/types/helpers/helpers.options.d.ts @@ -2,7 +2,7 @@ import { TRBL, TRBLCorners } from '../geometric'; import { FontSpec } from '../index.esm'; export interface CanvasFontSpec extends FontSpec { - string: string; + string: string; } /** * Parses font options and returns the font object. @@ -47,10 +47,10 @@ export function toPadding( * @since 2.7.0 */ export function resolve( - inputs: undefined | T | ((c: C) => T) | readonly T[], - context?: C, - index?: number, - info?: { cacheable?: boolean } + inputs: undefined | T | ((c: C) => T) | readonly T[], + context?: C, + index?: number, + info?: { cacheable?: boolean } ): T | undefined; diff --git a/types/helpers/helpers.rtl.d.ts b/types/helpers/helpers.rtl.d.ts index f366105bb..ed0b9248f 100644 --- a/types/helpers/helpers.rtl.d.ts +++ b/types/helpers/helpers.rtl.d.ts @@ -1,9 +1,9 @@ export interface RTLAdapter { - x(x: number): number; - setWidth(w: number): void; - textAlign(align: 'center' | 'left' | 'right'): 'center' | 'left' | 'right'; - xPlus(x: number, value: number): number; - leftForLtr(x: number, itemWidth: number): number; + x(x: number): number; + setWidth(w: number): void; + textAlign(align: 'center' | 'left' | 'right'): 'center' | 'left' | 'right'; + xPlus(x: number, value: number): number; + leftForLtr(x: number, itemWidth: number): number; } export function getRtlAdapter(rtl: boolean, rectX: number, width: number): RTLAdapter; diff --git a/types/index.esm.d.ts b/types/index.esm.d.ts index 550842f32..f1c37bdd3 100644 --- a/types/index.esm.d.ts +++ b/types/index.esm.d.ts @@ -87,9 +87,9 @@ export interface ControllerDatasetOptions extends ParsingOptions { export interface BarControllerDatasetOptions extends ControllerDatasetOptions, - ScriptableAndArrayOptions>, - ScriptableAndArrayOptions>, - AnimationOptions<'bar'> { + ScriptableAndArrayOptions>, + ScriptableAndArrayOptions>, + AnimationOptions<'bar'> { /** * The ID of the x axis to plot this dataset on. */ @@ -147,8 +147,8 @@ export const BarController: ChartComponent & { export interface BubbleControllerDatasetOptions extends ControllerDatasetOptions, - ScriptableAndArrayOptions>, - ScriptableAndArrayOptions> {} + ScriptableAndArrayOptions>, + ScriptableAndArrayOptions> {} export interface BubbleDataPoint { /** @@ -175,11 +175,11 @@ export const BubbleController: ChartComponent & { export interface LineControllerDatasetOptions extends ControllerDatasetOptions, - ScriptableAndArrayOptions>, - ScriptableAndArrayOptions>, - ScriptableOptions>, - ScriptableOptions>, - AnimationOptions<'line'> { + ScriptableAndArrayOptions>, + ScriptableAndArrayOptions>, + ScriptableOptions>, + ScriptableOptions>, + AnimationOptions<'line'> { /** * The ID of the x axis to plot this dataset on. */ @@ -234,9 +234,9 @@ export const ScatterController: ChartComponent & { export interface DoughnutControllerDatasetOptions extends ControllerDatasetOptions, - ScriptableAndArrayOptions>, - ScriptableAndArrayOptions>, - AnimationOptions<'doughnut'> { + ScriptableAndArrayOptions>, + ScriptableAndArrayOptions>, + AnimationOptions<'doughnut'> { /** * Sweep to allow arcs to cover. @@ -377,10 +377,10 @@ export const PolarAreaController: ChartComponent & { export interface RadarControllerDatasetOptions extends ControllerDatasetOptions, - ScriptableAndArrayOptions>, - ScriptableAndArrayOptions>, - AnimationOptions<'radar'> { - /** + ScriptableAndArrayOptions>, + ScriptableAndArrayOptions>, + AnimationOptions<'radar'> { + /** * The ID of the x axis to plot this dataset on. */ xAxisID: string; @@ -449,7 +449,7 @@ export type ChartMeta< // When this was introduced, doing so was a breaking change TType extends ChartType = ChartType, > = DeepPartial< - { [key in ChartType]: ChartTypeRegistry[key]['metaExtensions'] }[TType] +{ [key in ChartType]: ChartTypeRegistry[key]['metaExtensions'] }[TType] > & ChartMetaCommon; export interface ActiveDataPoint { @@ -465,7 +465,7 @@ export declare class Chart< TType extends ChartType = ChartType, TData = DefaultDataPoint, TLabel = unknown - > { +> { readonly platform: BasePlatform; readonly id: string; readonly canvas: HTMLCanvasElement; @@ -669,12 +669,12 @@ export interface Defaults extends CoreChartOptions, ElementChartOptio export type Overrides = { [key in ChartType]: - CoreChartOptions & - ElementChartOptions & - PluginChartOptions & - DatasetChartOptions & - ScaleChartOptions & - ChartTypeRegistry[key]['chartOptions']; + CoreChartOptions & + ElementChartOptions & + PluginChartOptions & + DatasetChartOptions & + ScaleChartOptions & + ChartTypeRegistry[key]['chartOptions']; } export const defaults: Defaults; @@ -1341,18 +1341,18 @@ export interface TypedRegistry { export interface ChartEvent { type: - | 'contextmenu' - | 'mouseenter' - | 'mousedown' - | 'mousemove' - | 'mouseup' - | 'mouseout' - | 'click' - | 'dblclick' - | 'keydown' - | 'keypress' - | 'keyup' - | 'resize'; + | 'contextmenu' + | 'mouseenter' + | 'mousedown' + | 'mousemove' + | 'mouseup' + | 'mouseout' + | 'click' + | 'dblclick' + | 'keydown' + | 'keypress' + | 'keyup' + | 'resize'; native: Event | null; x: number | null; y: number | null; @@ -1694,7 +1694,7 @@ export interface ArcHoverOptions extends CommonHoverOptions { export interface ArcElement extends Element, - VisualElement {} + VisualElement {} export const ArcElement: ChartComponent & { prototype: ArcElement; @@ -1771,7 +1771,7 @@ export interface LineHoverOptions extends CommonHoverOptions { export interface LineElement extends Element, - VisualElement { + VisualElement { updateControlPoints(chartArea: ChartArea, indexAxis?: 'x' | 'y'): void; points: Point[]; readonly segments: Segment[]; @@ -1889,7 +1889,7 @@ export interface PointPrefixedHoverOptions { export interface PointElement extends Element, - VisualElement { + VisualElement { readonly skip: boolean; readonly parsed: CartesianParsedData; } @@ -3472,12 +3472,12 @@ export type ScaleChartOptions = { }; export type ChartOptions = DeepPartial< - CoreChartOptions & - ElementChartOptions & - PluginChartOptions & - DatasetChartOptions & - ScaleChartOptions & - ChartTypeRegistry[TType]['chartOptions'] +CoreChartOptions & +ElementChartOptions & +PluginChartOptions & +DatasetChartOptions & +ScaleChartOptions & +ChartTypeRegistry[TType]['chartOptions'] >; export type DefaultDataPoint = DistributiveArray; @@ -3493,7 +3493,7 @@ export type ChartDataset< TType extends ChartType = ChartType, TData = DefaultDataPoint > = DeepPartial< - { [key in ChartType]: { type: key } & ChartTypeRegistry[key]['datasetOptions'] }[TType] +{ [key in ChartType]: { type: key } & ChartTypeRegistry[key]['datasetOptions'] }[TType] > & ChartDatasetProperties; export interface ChartData< diff --git a/types/layout.d.ts b/types/layout.d.ts index 36f3237f3..4c7707115 100644 --- a/types/layout.d.ts +++ b/types/layout.d.ts @@ -3,63 +3,63 @@ import { ChartArea } from './geometric'; export type LayoutPosition = 'left' | 'top' | 'right' | 'bottom' | 'center' | 'chartArea' | {[scaleId: string]: number}; export interface LayoutItem { - /** - * The position of the item in the chart layout. Possible values are - */ - position: LayoutPosition; - /** - * The weight used to sort the item. Higher weights are further away from the chart area - */ - weight: number; - /** - * if true, and the item is horizontal, then push vertical boxes down - */ - fullSize: boolean; - /** - * Width of item. Must be valid after update() - */ - width: number; - /** - * Height of item. Must be valid after update() - */ - height: number; - /** - * Left edge of the item. Set by layout system and cannot be used in update - */ - left: number; - /** - * Top edge of the item. Set by layout system and cannot be used in update - */ - top: number; - /** - * Right edge of the item. Set by layout system and cannot be used in update - */ - right: number; - /** - * Bottom edge of the item. Set by layout system and cannot be used in update - */ - bottom: number; + /** + * The position of the item in the chart layout. Possible values are + */ + position: LayoutPosition; + /** + * The weight used to sort the item. Higher weights are further away from the chart area + */ + weight: number; + /** + * if true, and the item is horizontal, then push vertical boxes down + */ + fullSize: boolean; + /** + * Width of item. Must be valid after update() + */ + width: number; + /** + * Height of item. Must be valid after update() + */ + height: number; + /** + * Left edge of the item. Set by layout system and cannot be used in update + */ + left: number; + /** + * Top edge of the item. Set by layout system and cannot be used in update + */ + top: number; + /** + * Right edge of the item. Set by layout system and cannot be used in update + */ + right: number; + /** + * Bottom edge of the item. Set by layout system and cannot be used in update + */ + bottom: number; - /** - * Called before the layout process starts - */ - beforeLayout?(): void; - /** - * Draws the element - */ - draw(chartArea: ChartArea): void; - /** - * Returns an object with padding on the edges - */ - getPadding?(): ChartArea; - /** - * returns true if the layout item is horizontal (ie. top or bottom) - */ - isHorizontal(): boolean; - /** - * Takes two parameters: width and height. - * @param width - * @param height - */ - update(width: number, height: number, margins?: ChartArea): void; + /** + * Called before the layout process starts + */ + beforeLayout?(): void; + /** + * Draws the element + */ + draw(chartArea: ChartArea): void; + /** + * Returns an object with padding on the edges + */ + getPadding?(): ChartArea; + /** + * returns true if the layout item is horizontal (ie. top or bottom) + */ + isHorizontal(): boolean; + /** + * Takes two parameters: width and height. + * @param width + * @param height + */ + update(width: number, height: number, margins?: ChartArea): void; } diff --git a/types/utils.d.ts b/types/utils.d.ts index 309c1608c..8313d9fae 100644 --- a/types/utils.d.ts +++ b/types/utils.d.ts @@ -6,10 +6,10 @@ export type DeepPartial = T extends Function ? T : T extends Array - ? _DeepPartialArray - : T extends object - ? _DeepPartialObject - : T | undefined; + ? _DeepPartialArray + : T extends object + ? _DeepPartialObject + : T | undefined; type _DeepPartialArray = Array> type _DeepPartialObject = { [P in keyof T]?: DeepPartial };