From 9453dd2a60411940af33cee4ea1be68f02cf33b0 Mon Sep 17 00:00:00 2001 From: Bar M <32390017+galshir@users.noreply.github.com> Date: Mon, 14 Sep 2026 19:29:11 +0300 Subject: [PATCH 1/2] fix(types): make time scale parser and tooltipFormat optional Neither option has a default in the time scale and both are guarded at runtime, so they should not be required members of TimeScaleTimeOptions. Fixes #12003 --- src/types/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/types/index.d.ts b/src/types/index.d.ts index 32831adc88c..8a6915fd393 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -3430,7 +3430,7 @@ export type TimeScaleTimeOptions = { /** * Custom parser for dates. */ - parser: string | ((v: unknown) => 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. */ @@ -3450,7 +3450,7 @@ export type TimeScaleTimeOptions = { /** * The format string to use for the tooltip. */ - tooltipFormat: string; + tooltipFormat?: string; /** * If defined, will force the unit to be a certain type. See Time Units section below for details. * @default false From e2e16ab82470ab5324db47d62aebd1d6ad064851 Mon Sep 17 00:00:00 2001 From: Bar M <32390017+galshir@users.noreply.github.com> Date: Mon, 14 Sep 2026 19:31:40 +0300 Subject: [PATCH 2/2] test(types): add time scale option type tests --- test/types/scales/time_options.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 test/types/scales/time_options.ts diff --git a/test/types/scales/time_options.ts b/test/types/scales/time_options.ts new file mode 100644 index 00000000000..7e7e7f69211 --- /dev/null +++ b/test/types/scales/time_options.ts @@ -0,0 +1,24 @@ +import { TimeScaleTimeOptions } from '../../../src/types.js'; + +// `time.parser` and `time.tooltipFormat` have no default value, so they must stay +// optional when the resolved time scale options are referenced directly. +const minimal: TimeScaleTimeOptions = { + unit: 'year', + round: false, + isoWeekday: false, + minUnit: 'millisecond', + displayFormats: { + month: 'yy' + } +}; + +const withParser: TimeScaleTimeOptions = { + ...minimal, + parser: 'yyyy-MM-dd', + tooltipFormat: 'eeee, MMM dd, yyyy' +}; + +const withParserFunction: TimeScaleTimeOptions = { + ...minimal, + parser: (value: unknown) => Number(value) +};