From 71f692265164d4d2fcba596e53332d3aea49be0e Mon Sep 17 00:00:00 2001 From: Ivan Demchuk Date: Sun, 16 Nov 2025 17:40:38 +0200 Subject: [PATCH 1/2] Stricter types for FluentVariable --- fluent-bundle/src/types.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/fluent-bundle/src/types.ts b/fluent-bundle/src/types.ts index 78fb49b5..c187adfe 100644 --- a/fluent-bundle/src/types.ts +++ b/fluent-bundle/src/types.ts @@ -4,12 +4,22 @@ import { Scope } from "./scope.js"; // Replace with Temporal.* types once they are provided by TypeScript // In addition to this minimal interface, these objects are also expected // to be supported by Intl.DateTimeFormat -interface TemporalObject { - epochMilliseconds?: number; +interface TemporalInstant { + epochMilliseconds: number + toString(): string; +} +interface TemporalDateTypes { + calendarId: string; toZonedDateTime?(timeZone: string): { epochMilliseconds: number }; - calendarId?: string; toString(): string; } +interface TemporalPlainTime { + hour: number + minute: number + second: number + toString(): string; +} +type TemporalObject = TemporalInstant | TemporalDateTypes | TemporalPlainTime export type FluentValue = FluentType | string; From 78b9f19f5780f4d689f69b22dbe496a678d497b8 Mon Sep 17 00:00:00 2001 From: Ivan Demchuk Date: Thu, 27 Nov 2025 09:42:19 +0000 Subject: [PATCH 2/2] Remove rendundant type assertion --- fluent-bundle/src/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fluent-bundle/src/types.ts b/fluent-bundle/src/types.ts index c187adfe..a26657ac 100644 --- a/fluent-bundle/src/types.ts +++ b/fluent-bundle/src/types.ts @@ -217,7 +217,7 @@ export class FluentDateTime extends FluentType { if (value instanceof Date) return value.getTime(); if ("epochMilliseconds" in value) { - return value.epochMilliseconds as number; + return value.epochMilliseconds; } if ("toZonedDateTime" in value) {