commit 60e7487cbe7036fbbce533f20a41a5cdfe7725e2
parent 5486f5260b4e046a1b1d80e656327f48a14855ab
Author: iulian moraru <imoraru@mozilla.com>
Date: Wed, 1 Oct 2025 22:26:22 +0300
Revert "Bug 1990504 - Exclude custom lit.all.mjs file from type check r=hjones" for causing multiple bc failures.
This reverts commit 07c9e545921ccaa37bc81d3c5803a8573c9413d2.
Revert "Bug 1990504 - Fix and import Setting and Preference types to avoid them being implicitly any r=hjones"
This reverts commit abe7692c971a64f0ab74bd03da764d474013bdfe.
Revert "Bug 1990504 - Expose Setting and Preferences types that are implicitly any r=hjones"
This reverts commit 3c8ee1c288fa100b17779e6e78917969a92fa13e.
Diffstat:
7 files changed, 12 insertions(+), 33 deletions(-)
diff --git a/browser/components/preferences/tsconfig.json b/browser/components/preferences/tsconfig.json
@@ -8,7 +8,6 @@
],
"exclude": ["tests", "../../../toolkit/content/widgets/vendor"],
"compilerOptions": {
- "noImplicitAny": true,
"checkJs": true,
"plugins": [
{
diff --git a/browser/components/preferences/widgets/setting-control/setting-control.mjs b/browser/components/preferences/widgets/setting-control/setting-control.mjs
@@ -18,7 +18,6 @@ import {
import { MozLitElement } from "chrome://global/content/lit-utils.mjs";
/** @import MozCheckbox from "../../../../../toolkit/content/widgets/moz-checkbox/moz-checkbox.mjs"*/
-/** @import { Setting } from "chrome://global/content/preferences/Setting.mjs"; */
/**
* A Lit directive that applies all properties of an object to a DOM element.
diff --git a/browser/components/preferences/widgets/setting-group/setting-group.mjs b/browser/components/preferences/widgets/setting-group/setting-group.mjs
@@ -5,9 +5,6 @@
import { html, ifDefined } from "chrome://global/content/vendor/lit.all.mjs";
import { MozLitElement } from "chrome://global/content/lit-utils.mjs";
-/** @import { SettingControl } from "../setting-control/setting-control.mjs"; */
-/** @import {PreferencesSettingsConfig, Preferences} from "chrome://global/content/preferences/Preferences.mjs" */
-
const CLICK_HANDLERS = new Set([
"dialog-button",
"moz-box-button",
@@ -17,24 +14,10 @@ const CLICK_HANDLERS = new Set([
]);
export class SettingGroup extends MozLitElement {
- /**
- * @type {PreferencesSettingsConfig | undefined}
- */
- config;
-
- /**
- * @type {Preferences['getSetting'] | undefined}
- */
- getSetting;
-
- /**
- * @type {Array<SettingControl>}
- */
- controlEls;
-
static properties = {
config: { type: Object },
groupId: { type: String },
+ // getSetting should be Preferences.getSetting from preferencesBindings.js
getSetting: { type: Function },
};
@@ -72,9 +55,6 @@ export class SettingGroup extends MozLitElement {
control?.onClick(e);
}
- /**
- * @param {PreferencesSettingsConfig} item
- */
itemTemplate(item) {
let setting = this.getSetting(item.id);
return html`<setting-control
diff --git a/toolkit/content/preferences/AsyncSetting.mjs b/toolkit/content/preferences/AsyncSetting.mjs
@@ -98,7 +98,7 @@ export class AsyncSettingHandler {
/** @type {Function} */
#emitChange;
- /** @type {import("./Setting.mjs").PreferenceSettingDepsMap} */
+ /** @type {Record<string, Setting>} */
deps;
/** @type {Setting} */
diff --git a/toolkit/content/preferences/Preferences.mjs b/toolkit/content/preferences/Preferences.mjs
@@ -6,13 +6,16 @@ import { AsyncSetting } from "chrome://global/content/preferences/AsyncSetting.m
import { Preference } from "chrome://global/content/preferences/Preference.mjs";
import { Setting } from "chrome://global/content/preferences/Setting.mjs";
-/** @import {PreferenceConfigInfo} from "chrome://global/content/preferences/Preference.mjs" */
-/** @import {PreferenceSettingDepsMap} from "chrome://global/content/preferences/Setting.mjs" */
+/**
+ * A map of Setting instances (values) along with their IDs
+ * (keys) so that the dependencies of a setting can
+ * be easily looked up by just their ID.
+ *
+ * @typedef {Record<string, Setting>} PreferenceSettingDepsMap
+ */
/**
* @callback PreferenceSettingVisibleFunction
- * @param {PreferenceSettingDepsMap} deps
- * @param {Setting} setting
* @returns {boolean | string | undefined} If truthy shows the setting in the UI, or hides it if not
*/
@@ -22,7 +25,7 @@ import { Setting } from "chrome://global/content/preferences/Setting.mjs";
* @callback PreferenceSettingGetter
* @param {string | number} val - The value that was retrieved from the preferences backend
* @param {PreferenceSettingDepsMap} deps
- * @param {Setting} setting
+ * @param {Setting} setting*
* @returns {any} - The value to set onto the setting
*/
@@ -46,6 +49,7 @@ import { Setting } from "chrome://global/content/preferences/Setting.mjs";
/**
* @callback PreferencesSettingConfigDisabledFunction
+ * @param {string} val - The value/pressed/checked from the input of the control associated with the setting
* @param {PreferenceSettingDepsMap} deps
* @param {Setting} setting
* @returns {boolean}
diff --git a/toolkit/content/preferences/Setting.mjs b/toolkit/content/preferences/Setting.mjs
@@ -9,7 +9,6 @@ import {
import { Preferences } from "chrome://global/content/preferences/Preferences.mjs";
/** @import { type Preference } from "chrome://global/content/preferences/Preference.mjs" */
-/** @import { PreferencesSettingsConfig } from "chrome://global/content/preferences/Preferences.mjs" */
const { EventEmitter } = ChromeUtils.importESModule(
"resource://gre/modules/EventEmitter.sys.mjs"
@@ -28,7 +27,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
* (keys) so that the dependencies of a setting can
* be easily looked up by just their ID.
*
- * @typedef {Record<string, Setting | undefined>} PreferenceSettingDepsMap
+ * @typedef {Record<string, any>} PreferenceSettingDepsMap
*/
export class Setting extends EventEmitter {
diff --git a/toolkit/content/tsconfig.json b/toolkit/content/tsconfig.json
@@ -5,9 +5,7 @@
"widgets/**/*.mjs",
"./preferencesBindings.js"
],
- "exclude": ["widgets/vendor/lit.all.mjs"],
"compilerOptions": {
- "noImplicitAny": true,
"checkJs": true,
"plugins": [
{