tor-browser

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

commit f6d20b53a167a00aa951544cd44b46a59c9da413
parent 5d5d1047f83747d0d73e09099486f6b616cb608e
Author: Erik Nordin <enordin@mozilla.com>
Date:   Tue,  4 Nov 2025 21:51:32 +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] : []) ); }