tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 5dc1652c98f4761685e0df59dbd5dbb635f97698
parent 5603d97b64819e5f13d0035b0b94b748351b4ecb
Author: Erik Nordin <enordin@mozilla.com>
Date:   Wed,  5 Nov 2025 16:02:29 +0000

Bug 1997612 - Add @ts-check to TranslationsTelemetry r=translations-reviewers,gregtatum

I want to start adding @ts-check to as many files as I can,
incrementally, as I make changes to them. This introduces
@ts-check to the Translations telemetry code.

Differential Revision: https://phabricator.services.mozilla.com/D270874

Diffstat:
Mtoolkit/components/translations/TranslationsTelemetry.sys.mjs | 16++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/toolkit/components/translations/TranslationsTelemetry.sys.mjs b/toolkit/components/translations/TranslationsTelemetry.sys.mjs @@ -2,7 +2,15 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -const lazy = {}; +// @ts-check + +/** + * @typedef {object} Lazy + * @property {typeof console} console + */ + +/** @type {Lazy} */ +const lazy = /** @type {any} */ ({}); ChromeUtils.defineLazyGetter(lazy, "console", () => { return console.createInstance({ @@ -27,9 +35,9 @@ export class TranslationsTelemetry { * @param {object} [data] - Optional data passed to telemetry. */ static logEventToConsole(caller, data) { - const id = TranslationsTelemetry.getOrCreateFlowId().substring(0, 5); - lazy.console?.debug( - `flowId[${id}]: ${caller.name}`, + const logId = TranslationsTelemetry.getOrCreateFlowId().substring(0, 5); + lazy.console?.log( + `flowId[${logId}]: ${caller.name}`, ...(data ? [data] : []) ); }