From ee02366ccf6ea941ef5f9d338003b42b6018feac Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Fri, 11 Jul 2025 01:09:09 -0600 Subject: [PATCH] [Misc] Make FixedInt support coercion to number primitive (#6081) --- src/utils/common.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/utils/common.ts b/src/utils/common.ts index 753d6ebb865..569f69e132e 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -341,6 +341,10 @@ export class NumberHolder { constructor(value: number) { this.value = value; } + + valueOf(): number { + return this.value; + } } export class FixedInt { @@ -349,6 +353,10 @@ export class FixedInt { constructor(value: number) { this.value = value; } + + [Symbol.toPrimitive](_hint: string): number { + return this.value; + } } export function fixedInt(value: number): number {