diff --git a/ts/lib/i18n/bundles.ts b/ts/lib/i18n/bundles.ts index f60aadedc..a38e99952 100644 --- a/ts/lib/i18n/bundles.ts +++ b/ts/lib/i18n/bundles.ts @@ -23,12 +23,17 @@ function toFluentNumber(num: number): FluentNumber { function formatArgs( args: Record, ): Record { - return Object.fromEntries( - Object.entries(args).map(([key, value]) => [ + const entries: [string, FluentVariable][] = Object.entries(args).map( + ([key, value]) => [ key, typeof value === "number" ? toFluentNumber(value) : value, - ]), + ], ); + const out: Record = {}; + for (const [key, value] of entries) { + out[key] = value; + } + return out; } export function getMessage( diff --git a/ts/lib/runtime-require.ts b/ts/lib/runtime-require.ts index 336b0270c..bcbb7be8a 100644 --- a/ts/lib/runtime-require.ts +++ b/ts/lib/runtime-require.ts @@ -10,7 +10,7 @@ export const runtimeLibraries = {}; // Export require() as a global. -(globalThis as any).require = function (name: string): unknown { +(window as any).require = function (name: string): unknown { const lib = runtimeLibraries[name]; if (lib === undefined) { throw new Error(`Cannot require(${name}) at runtime.`); diff --git a/ts/reviewer/reviewer_extras.ts b/ts/reviewer/reviewer_extras.ts index 926ccd5db..fb4477063 100644 --- a/ts/reviewer/reviewer_extras.ts +++ b/ts/reviewer/reviewer_extras.ts @@ -1,9 +1,13 @@ // Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html +/* eslint +@typescript-eslint/no-explicit-any: "off", + */ + // A standalone bundle that adds mutateNextCardStates to the anki namespace. // When all clients are using reviewer.js directly, we can get rid of this. import { mutateNextCardStates } from "./answering"; -globalThis.anki.mutateNextCardStates = mutateNextCardStates; +(window as any).anki.mutateNextCardStates = mutateNextCardStates;