A platform for community discussion. Free, open, simple.
DEV: Type strict-narrowed members in library modules (#44653)
Sérgio Saquetim8d630c5118b0
diff --git a/frontend/discourse/admin/lib/color-scheme-manager.js b/frontend/discourse/admin/lib/color-scheme-manager.jsindex fff6caa8636..ee88cb26810 100644--- a/frontend/discourse/admin/lib/color-scheme-manager.js+++ b/frontend/discourse/admin/lib/color-scheme-manager.js@@ -103,7 +103,7 @@ export function showColorMode(mode) {/*** Apply color scheme by updating stylesheet links*- * @param {Object} scheme - color scheme to apply+ * @param {{ id?: number | null, save?: (options: { forceSave: boolean }) => unknown } | null | undefined} scheme - color scheme to apply* @param {Object} options* @param {boolean} options.replace - replace existing tags? (default: false)* @param {boolean} options.save - save changes to the server? (default: false)@@ -203,8 +203,8 @@ export async function applyColorScheme(scheme, options = {}) {/*** Set color scheme as active for the default theme and apply immediately*- * @param {Object} scheme - color scheme to set as default- * @param {Object} defaultTheme - the default theme object+ * @param {{ id: number, is_base: boolean, updateDefaultOnTheme: (field: string, value: boolean) => unknown }} scheme - color scheme to set as default+ * @param {{ color_scheme_id: number | null, dark_color_scheme_id: number | null } | null | undefined} defaultTheme - the default theme object* @param {Object} options* @param {string} options.previewMode - preview mode: "live", "none", or "reload" (default: auto-detect)* @param {string} options.mode - "light" or "dark" (default: "light")diff --git a/frontend/discourse/admin/lib/site-setting-filter.js b/frontend/discourse/admin/lib/site-setting-filter.jsindex a700c9a5573..89849f833e0 100644--- a/frontend/discourse/admin/lib/site-setting-filter.js+++ b/frontend/discourse/admin/lib/site-setting-filter.js@@ -57,7 +57,8 @@ export default class SiteSettingFilter {all = {nameKey: "all_results",name: i18n("admin.site_settings.categories.all_results"),- siteSettings: [],+ siteSettings:+ /** @type {import("discourse/admin/models/site-setting").default[]} */ ([]),};matchesGroupedByCategory.push(all);diff --git a/frontend/discourse/admin/lib/toggleable-ordered-list.js b/frontend/discourse/admin/lib/toggleable-ordered-list.jsindex bb45fdcc04c..1145a17657e 100644--- a/frontend/discourse/admin/lib/toggleable-ordered-list.js+++ b/frontend/discourse/admin/lib/toggleable-ordered-list.js@@ -2,8 +2,11 @@ import { tracked } from "@glimmer/tracking";export default class ToggleableOrderedList {@tracked enabledOrder;++ /** @type {string | null} */@tracked draggedId = null;+ /** @param {{ cap?: number, minSelected?: number, initialOrder?: string[] }} [options] */constructor({ cap, minSelected = 0, initialOrder = [] } = {}) {this.cap = cap;this.minSelected = minSelected;diff --git a/frontend/discourse/app/blocks/block-outlet.gts b/frontend/discourse/app/blocks/block-outlet.gtsindex 097ce45e616..c546935f3b7 100644--- a/frontend/discourse/app/blocks/block-outlet.gts+++ b/frontend/discourse/app/blocks/block-outlet.gts@@ -15,6 +15,7 @@ import { cached } from "@glimmer/tracking";import type Owner from "@ember/owner";import curryComponent from "ember-curry-component";import type { BlockMetadata, LayoutEntry } from "discourse/blocks/types";+import type deprecatedOutletArgument from "discourse/helpers/deprecated-outlet-argument";import { wrapBlockLayout } from "discourse/lib/blocks/-internals/components/block-layout-wrapper";import BlockOutletInlineError from "discourse/lib/blocks/-internals/components/block-outlet-inline-error";import BlockOutletRootContainer from "discourse/lib/blocks/-internals/components/block-outlet-root-container";@@ -372,7 +373,10 @@ interface BlockOutletSignature {// Arguments to pass to blocks rendered in this outlet.outletArgs?: Record<string, unknown>;// Deprecated args with deprecation warnings.- deprecatedArgs?: Record<string, unknown>;+ deprecatedArgs?: Record<+ string,+ ReturnType<typeof deprecatedOutletArgument>+ >;};Blocks: {// Yields hasLayout flag before content.@@ -545,13 +549,11 @@ export default class BlockOutlet extends Component<BlockOutletSignature> {if (!this.args.deprecatedArgs) {return this.args.outletArgs || {};}- // `buildArgsWithDeprecations` is authored in untyped `.js`; its actual- // runtime return is a plain object keyed by the combined arg names.return buildArgsWithDeprecations(this.args.outletArgs || {},this.args.deprecatedArgs,{ outletName: this.#name }- ) as Record<string, unknown>;+ );}<template>diff --git a/frontend/discourse/app/data/warp-rest-model.js b/frontend/discourse/app/data/warp-rest-model.jsindex 762dcc2c60c..66b2b40b425 100644--- a/frontend/discourse/app/data/warp-rest-model.js+++ b/frontend/discourse/app/data/warp-rest-model.js@@ -15,9 +15,33 @@ export function warpStore() {// static type — schema type, e.g. "badge"// static normalize — rooted JSON → JSON:API document// static builders — { list(opts), one(id), save(record, data), delete(id) }+/**+ * A request object built by the helpers in `discourse/data/builders/helpers`.+ *+ * @typedef {object} WarpRequest+ * @property {string} url+ * @property {string} method+ * @property {string} op+ * @property {{ type: string, id: string }} [data]+ * @property {{ body?: unknown, normalize?: (payload: Record<string, unknown> | null | undefined) => import("@warp-drive/core/types/spec/json-api-raw").JsonApiDocument }} [options]+ */++/**+ * @typedef {object} WarpRestBuilders+ * @property {(opts?: Record<string, unknown>) => WarpRequest} [list]+ * @property {(id: string | number) => WarpRequest} [one]+ * @property {(record: WarpRestModel, data: Record<string, unknown>) => WarpRequest} [save]+ * @property {(id: string | number) => WarpRequest} [delete]+ */+export default class WarpRestModel {+ /** @type {string | null} */static type = null;++ /** @type {((payload: Record<string, unknown> | null | undefined) => import("@warp-drive/core/types/spec/json-api-raw").JsonApiDocument) | null} */static normalize = null;++ /** @type {WarpRestBuilders | null} */static builders = null;static findAll(opts) {diff --git a/frontend/discourse/app/deprecation-workflow.js b/frontend/discourse/app/deprecation-workflow.jsindex df2e290f535..42b80acc611 100644--- a/frontend/discourse/app/deprecation-workflow.js+++ b/frontend/discourse/app/deprecation-workflow.js@@ -54,7 +54,7 @@ export class DiscourseDeprecationWorkflow {/*** Gets the list of active workflows.- * @return {Object[]} Array of active workflow configurations+ * @returns {Array<{ handler: string[], matchId: string | RegExp, env: string[] }>} Array of active workflow configurations*/get list() {return this.#activeWorkflows;@@ -62,7 +62,7 @@ export class DiscourseDeprecationWorkflow {/*** Gets Ember-specific workflows formatted for Ember CLI.- * @return {Object[]} Array of formatted Ember workflow configurations+ * @returns {Array<{ handler: string, matchId: string | RegExp, env: string[] }>} Array of formatted Ember workflow configurations*/get emberWorkflowList() {return this.#activeWorkflows@@ -80,7 +80,7 @@ export class DiscourseDeprecationWorkflow {/*** Sets the current environment and updates active workflows.- * @param {Object} environment - Environment object+ * @param {{ isProduction: () => boolean, isTesting: () => boolean, isRailsTesting: () => boolean } | null | undefined} environment - Environment object*/setEnvironment(environment) {this.#environment = environment;diff --git a/frontend/discourse/app/form-kit/components/fk/control/conditional-content.gjs b/frontend/discourse/app/form-kit/components/fk/control/conditional-content.gjsindex 132f9c9e713..6a6f7b82f56 100644--- a/frontend/discourse/app/form-kit/components/fk/control/conditional-content.gjs+++ b/frontend/discourse/app/form-kit/components/fk/control/conditional-content.gjs@@ -25,6 +25,7 @@ const Contents = <template></template>;export default class FKControlConditionalContent extends Component {+ /** @type {string | null | undefined} */@tracked manuallySetName = null;// Bumped after `onChange` settles to re-sync the radios with `activeName`,// so a rejected change doesn't leave the clicked radio selected.diff --git a/frontend/discourse/app/form-kit/components/fk/field-data.gjs b/frontend/discourse/app/form-kit/components/fk/field-data.gjsindex 91da10b1166..98606f6aeed 100644--- a/frontend/discourse/app/form-kit/components/fk/field-data.gjs+++ b/frontend/discourse/app/form-kit/components/fk/field-data.gjs@@ -61,7 +61,7 @@ export default class FKFieldData extends Component {/*** Parses the validation rules for the field.- * @type {Object|null}+ * @returns {{ required?: { trim: boolean }, startsWith?: { prefix: string | undefined }, endsWith?: { suffix: string | undefined }, between?: { min: number, max: number | undefined }, length?: { min: number, max: number | undefined }, dateBeforeOrEqual?: { date: Date }, dateAfterOrEqual?: { date: Date }, [rule: string]: Record<string, unknown> | undefined } | null}*/get rules() {return this.args.validation@@ -249,7 +249,7 @@ export default class FKFieldData extends Component {/*** Validation rules for the field.- * @type {string|Object}+ * @returns {string | null | undefined}*/get validation() {return this.args.validation;@@ -319,10 +319,9 @@ export default class FKFieldData extends Component {/*** Validates the field value.* @param {string} name - The name of the field.- * @param {any} value - The value of the field.- * @param {Object} data - Additional data for validation.- * @param {Object} context - Additional validation handlers.- * @param {Function} context.preventSubmit - Prevents the current submission.+ * @param {unknown} value - The value of the field.+ * @param {Record<string, unknown>} data - Additional data for validation.+ * @param {{ preventSubmit: () => void }} context - Additional validation handlers.* @returns {Promise<void>}*/async validate(name, value, data, { preventSubmit }) {diff --git a/frontend/discourse/app/form-kit/lib/fk-form-data.js b/frontend/discourse/app/form-kit/lib/fk-form-data.jsindex cc12e3d3fca..35a6375cd6a 100644--- a/frontend/discourse/app/form-kit/lib/fk-form-data.js+++ b/frontend/discourse/app/form-kit/lib/fk-form-data.js@@ -22,7 +22,7 @@ export default class FKFormData {/*** The errors associated with the changeset.- * @type {Object}+ * @type {Record<string, { title: string, messages: string[] }>}*/@tracked errors = {};diff --git a/frontend/discourse/app/helpers/category-list-subcategories.js b/frontend/discourse/app/helpers/category-list-subcategories.jsindex 289a85213e0..440b2a8ab17 100644--- a/frontend/discourse/app/helpers/category-list-subcategories.js+++ b/frontend/discourse/app/helpers/category-list-subcategories.js@@ -34,7 +34,7 @@ export default function categoryListSubcategories(* list needs the grandparent layout rather than plain subcategory links.** @param {Category[]} subcategories the subcategories being rendered- * @param {Object} [options] the options passed to `categoryListSubcategories`+ * @param {{ page?: string, subcategories?: Category[] }} [options] the options passed to `categoryListSubcategories`* @returns {boolean}*/export function hasGrandchildren(subcategories, options) {diff --git a/frontend/discourse/app/instance-initializers/webview-background.js b/frontend/discourse/app/instance-initializers/webview-background.jsindex 888488d96d9..1f068e883bd 100644--- a/frontend/discourse/app/instance-initializers/webview-background.js+++ b/frontend/discourse/app/instance-initializers/webview-background.js@@ -5,7 +5,7 @@ import { postRNWebviewMessage } from "discourse/lib/utilities";export default {after: "inject-objects",retryCount: 0,- isAppWebview: undefined,+ isAppWebview: /** @type {boolean | undefined} */ (undefined),mediaQuery: "(prefers-color-scheme: dark)",initialize(owner) {diff --git a/frontend/discourse/app/lib/body-scroll-lock.js b/frontend/discourse/app/lib/body-scroll-lock.jsindex d2bab94babe..d3b6835d678 100644--- a/frontend/discourse/app/lib/body-scroll-lock.js+++ b/frontend/discourse/app/lib/body-scroll-lock.js@@ -83,8 +83,8 @@ function toArray(x) {const initialLockState = {lockedNum: 0,- lockedElements: [],- unLockCallback: null,+ lockedElements: /** @type {HTMLElement[]} */ ([]),+ unLockCallback: /** @type {(() => void) | null} */ (null),documentListenerAdded: false,initialClientPos: {clientX: 0,diff --git a/frontend/discourse/app/lib/bulk-select-helper.js b/frontend/discourse/app/lib/bulk-select-helper.jsindex 0f09a6fa2e2..48c51b08344 100644--- a/frontend/discourse/app/lib/bulk-select-helper.js+++ b/frontend/discourse/app/lib/bulk-select-helper.js@@ -16,6 +16,8 @@ export default class BulkSelectHelper {@tracked bulkSelectEnabled = false;@tracked autoAddTopicsToBulkSelect = false;@tracked autoAddBookmarksToBulkSelect = false;++ /** @type {string | null | undefined} */@tracked lastCheckedElementId = null;@autoTrackedArray selected;diff --git a/frontend/discourse/app/lib/content-localization.js b/frontend/discourse/app/lib/content-localization.jsindex c1a5b34d582..71aa4cafde9 100644--- a/frontend/discourse/app/lib/content-localization.js+++ b/frontend/discourse/app/lib/content-localization.js@@ -12,7 +12,7 @@ export const LOCALE_COOKIE_EXPIRY = 365;* whether the `locale` cookie is honoured. Keep the two in sync: a cookie that is honoured* without the corresponding UI leaves visitors stuck in a locale they cannot change back.*- * @param {Object} siteSettings - the siteSettings service+ * @param {{ content_localization_enabled: boolean, allow_user_locale: boolean, content_localization_language_switcher: string, content_localization_supported_locales: string }} siteSettings - the siteSettings service* @returns {boolean}*/export function languageSwitcherEnabled(siteSettings) {diff --git a/frontend/discourse/app/lib/design-wizard-preview.js b/frontend/discourse/app/lib/design-wizard-preview.jsindex 94faa8261d2..3043855f316 100644--- a/frontend/discourse/app/lib/design-wizard-preview.js+++ b/frontend/discourse/app/lib/design-wizard-preview.js@@ -8,8 +8,8 @@ function hex(colors, name, fallback) {/*** Builds the inline style for a palette swatch in the design wizard rail.*- * @param {Object} palette - serialized palette with a `colors` map- * @returns {ReturnType<typeof trustHTML>} inline style string+ * @param {{ colors?: Record<string, string> } | null | undefined} palette - serialized palette with a `colors` map+ * @returns {import("@ember/template").TrustedHTML} inline style string*/export function swatchStyle(palette) {const bg = hex(palette?.colors, "secondary", "ffffff");diff --git a/frontend/discourse/app/lib/discourse-template-map.js b/frontend/discourse/app/lib/discourse-template-map.jsindex 78097cc9ad1..5c7ad235a7b 100644--- a/frontend/discourse/app/lib/discourse-template-map.js+++ b/frontend/discourse/app/lib/discourse-template-map.js@@ -97,7 +97,7 @@ class DiscourseTemplateMap {* Identifies the source (core, plugin, or theme) of a template.** @param {string} name - The template path to look up- * @return {Object|undefined} Source information containing type and name, or undefined if not found+ * @returns {{ type: "plugin" | "theme", name: string } | undefined} Source information containing type and name, or undefined if not found*/identifySource(name) {return this.sources.get(name);diff --git a/frontend/discourse/app/lib/download-calendar.js b/frontend/discourse/app/lib/download-calendar.jsindex c92bde8fa31..51b0a4a7894 100644--- a/frontend/discourse/app/lib/download-calendar.js+++ b/frontend/discourse/app/lib/download-calendar.js@@ -409,8 +409,8 @@ function _generateVTimezone(timezone, referenceMs) {* Generate ICS calendar data for the given dates** @param {string} title - Event title- * @param {Array} dates - Array of date objects with startsAt, endsAt, optional timezone, and optional allDay (date-only event)- * @param {Object} options - Optional parameters (rrule, location, details, timezone)+ * @param {Array<{ startsAt: string, endsAt?: string | null, timezone?: string, allDay?: boolean }>} dates - Array of date objects with startsAt, endsAt, optional timezone, and optional allDay (date-only event)+ * @param {{ rrule?: string | null, location?: string | null, details?: string | null, timezone?: string | null }} [options] - Optional parameters (rrule, location, details, timezone)* @returns {string} - ICS formatted calendar data*/export function generateIcsData(title, dates, options = {}) {diff --git a/frontend/discourse/app/lib/filter-suggestions.js b/frontend/discourse/app/lib/filter-suggestions.jsindex fa4fd2ab461..ced04ab9f74 100644--- a/frontend/discourse/app/lib/filter-suggestions.js+++ b/frontend/discourse/app/lib/filter-suggestions.js@@ -13,13 +13,34 @@ const EMPTY_SEGMENT = Object.freeze({value: null,});+/**+ * @typedef {{ name: string, description: string }} FilterOptionModifier+ * @typedef {{ id: number, name: string, slug: string }} FilterCategory+ * @typedef {object} FilterTip+ * @property {string} name+ * @property {string} description+ * @property {string} [alias]+ * @property {number} [priority]+ * @property {string} [type]+ * @property {number} [min]+ * @property {FilterOptionModifier[]} [prefixes]+ * @property {FilterOptionModifier[]} [delimiters]+ * @property {FilterOptionModifier[]} [extra_entries]+ * @typedef {object} FilterSuggestion+ * @property {string} name+ * @property {string} [description]+ * @property {string} [term]+ * @property {boolean} [isSuggestion]+ * @property {FilterCategory} [category]+ * @property {FilterOptionModifier[]} [delimiters]+ */export default class FilterSuggestions {/*** Main entry point - takes raw input text and available tips, returns suggestions* @param {string} text - The full input text from the user- * @param {Array} tips - Available filter tips from the server- * @param {Object} context - Additional context (site data, etc.)- * @returns {Object} { suggestions: Array, activeFilter: string|null }+ * @param {FilterTip[]} [tips] - Available filter tips from the server+ * @param {{ site?: { categories?: FilterCategory[] } }} [context] - Additional context (site data, etc.)+ * @returns {Promise<{ suggestions: Array<FilterTip | FilterSuggestion>, activeFilter: string | null }>}*/static async getSuggestions(text, tips = [], context = {}) {const lastSegment = parseLastSegment(text);diff --git a/frontend/discourse/app/lib/hashtag-types/tag.js b/frontend/discourse/app/lib/hashtag-types/tag.jsindex 9e488d54950..a9a3bddaed0 100644--- a/frontend/discourse/app/lib/hashtag-types/tag.js+++ b/frontend/discourse/app/lib/hashtag-types/tag.js@@ -6,10 +6,12 @@ export default class TagHashtagType extends HashtagTypeBase {return "tag";}+ /** @returns {import("discourse/models/tag").default[]} */get preloadedData() {return [];}+ /** @returns {string[]} */generateColorCssClasses() {return [];}diff --git a/frontend/discourse/app/lib/invite-modal.js b/frontend/discourse/app/lib/invite-modal.jsindex 212c51abb43..ebefc8d8906 100644--- a/frontend/discourse/app/lib/invite-modal.js+++ b/frontend/discourse/app/lib/invite-modal.js@@ -6,9 +6,9 @@ import CreateInviteWithRoles from "discourse/components/modal/create-invite-with* Opens the invite creation modal, selecting the redesigned role-based* variant when the `enable_invite_modal_with_roles` upcoming change is enabled.*- * @param {Object} context - any owned object (component, route, controller)- * @param {Object} opts - options forwarded to `modal.show`, e.g. `{ model }`- * @returns {Promise} the modal promise from `modal.show`+ * @param {object} context - any owned object (component, route, controller)+ * @param {{ model?: { invites?: import("discourse/models/invite").default[], editing?: boolean, invite?: import("discourse/models/invite").default, groupIds?: number[], inviteToTopic?: boolean, topics?: import("discourse/models/topic").default[], topicId?: number, topicTitle?: string, defaultRole?: string } }} [opts] - options forwarded to `modal.show`, e.g. `{ model }`+ * @returns {Promise<unknown>} the modal promise from `modal.show`*/export function showCreateInviteModal(context, opts = {}) {const owner = getOwner(context);diff --git a/frontend/discourse/app/lib/key-value-store.js b/frontend/discourse/app/lib/key-value-store.jsindex e97dc3b96c1..a019bc923af 100644--- a/frontend/discourse/app/lib/key-value-store.js+++ b/frontend/discourse/app/lib/key-value-store.js@@ -19,6 +19,7 @@ try {}export default class KeyValueStore {+ /** @type {string | null | undefined} */context = null;constructor(ctx) {diff --git a/frontend/discourse/app/lib/legacy-array-like-object.js b/frontend/discourse/app/lib/legacy-array-like-object.jsindex 4c80e66d919..f9ee3483f0f 100644--- a/frontend/discourse/app/lib/legacy-array-like-object.js+++ b/frontend/discourse/app/lib/legacy-array-like-object.js@@ -75,7 +75,7 @@ export default class LegacyArrayLikeObject extends EmberObject {/*** Creates an instance of LegacyArrayLikeObject. Must be used instead of `new`.*- * @param {Object} attrs - Properties to set on the instance. `content` must be an array.+ * @param {{ content?: unknown[] } & Record<string, unknown>} [attrs] - Properties to set on the instance. `content` must be an array.* @returns {LegacyArrayLikeObject}*/static create(attrs = {}) {diff --git a/frontend/discourse/app/lib/nested-topic-model.js b/frontend/discourse/app/lib/nested-topic-model.jsindex 9d398bf81bb..8b6df902789 100644--- a/frontend/discourse/app/lib/nested-topic-model.js+++ b/frontend/discourse/app/lib/nested-topic-model.js@@ -1,5 +1,11 @@import processNode from "discourse/lib/process-node";+/**+ * @typedef {object} NestedPostNode+ * @property {import("discourse/models/post").default} post+ * @property {NestedPostNode[]} children+ * @property {number | string} _renderKey+ */export function processNestedRootResponse({data,params,@@ -33,13 +39,13 @@ export function processNestedRootResponse({postNumber: params.post_number ? Number(params.post_number) : null,context: params.context ?? null,contextMode: false,- contextChain: null,- initialFocusedPath: [],- targetPostNumber: null,+ contextChain: /** @type {NestedPostNode | null} */ (null),+ initialFocusedPath: /** @type {NestedPostNode[]} */ ([]),+ targetPostNumber: /** @type {number | null} */ (null),contextNoAncestors: false,ancestorsTruncated: false,- topAncestorPostNumber: null,- newRootPostIds: [],+ topAncestorPostNumber: /** @type {number | null} */ (null),+ newRootPostIds: /** @type {number[]} */ ([]),editingTopic: false,};}@@ -86,7 +92,7 @@ export function processNestedContextResponse({opPost,sort,effectiveSort: data.effective_sort || sort,- pinnedPostIds: [],+ pinnedPostIds: /** @type {number[]} */ ([]),messageBusLastId: data.message_bus_last_id,postNumber: Number(params.post_number),context: params.context ?? null,@@ -101,7 +107,7 @@ export function processNestedContextResponse({rootNodes: [chainTip],page: 0,hasMoreRoots: false,- newRootPostIds: [],+ newRootPostIds: /** @type {number[]} */ ([]),editingTopic: false,};}diff --git a/frontend/discourse/app/lib/on-before-category-types-change.js b/frontend/discourse/app/lib/on-before-category-types-change.jsindex 2c7272161d9..8b0f31dc91e 100644--- a/frontend/discourse/app/lib/on-before-category-types-change.js+++ b/frontend/discourse/app/lib/on-before-category-types-change.js@@ -9,8 +9,8 @@ const callbacks = [];* @property {import("discourse/services/category-type-chooser").CategoryType[]} previousTypes - Snapshot of the selection before this change (shallow-copied* array, same object references as before).* @property {import("discourse/models/category").default} category - The category being edited.- * @property {Object} form - The Form API object for the edit category form.- * @property {Object} [transientData] - Transient data from the Form wrapper, when available.+ * @property {{ set: (name: string, value: unknown) => Promise<void>, setProperties: (values: Record<string, unknown>) => Promise<void> } & Record<string, unknown>} form - The Form API object for the edit category form.+ * @property {Record<string, unknown>} [transientData] - Transient data from the Form wrapper, when available.*//**diff --git a/frontend/discourse/app/lib/outlet-args.js b/frontend/discourse/app/lib/outlet-args.jsindex e9236805867..1ddbc0fd398 100644--- a/frontend/discourse/app/lib/outlet-args.js+++ b/frontend/discourse/app/lib/outlet-args.js@@ -40,11 +40,11 @@ export function _setIncludeDeprecatedArgsProperty(value) {* Both current and deprecated args are accessed via property getters for lazy* evaluation. Deprecated args trigger a deprecation warning when accessed.*- * @param {Object} args - Current outlet args.- * @param {Object} deprecatedArgs - Deprecated args created with `deprecatedOutletArgument` helper.+ * @param {Record<string, unknown> | null | undefined} args - Current outlet args.+ * @param {Record<string, ReturnType<typeof import("discourse/helpers/deprecated-outlet-argument").default>> | null | undefined} deprecatedArgs - Deprecated args created with `deprecatedOutletArgument` helper.* @param {Object} [opts={}] - Options passed to deprecation warnings.* @param {string} [opts.outletName] - The outlet name for warning messages.- * @returns {Object} Combined args object with lazy property getters.+ * @returns {Record<string, unknown>} Combined args object with lazy property getters.** @example* const argsWithDeprecations = buildArgsWithDeprecations(@@ -107,7 +107,7 @@ export function buildArgsWithDeprecations(args, deprecatedArgs, opts = {}) {* The warning is triggered each time the value is accessed. If the deprecated* arg has a `silence` option, the warning is silenced under that deprecation ID.*- * @param {Object} deprecatedArg - A deprecated arg created with `deprecatedOutletArgument` helper.+ * @param {ReturnType<typeof import("discourse/helpers/deprecated-outlet-argument").default>} deprecatedArg - A deprecated arg created with `deprecatedOutletArgument` helper.* @param {Object} options - Options for the deprecation warning.* @param {string} options.argumentName - The name of the deprecated arg.* @param {string} [options.outletName] - The outlet name for the warning message.@@ -115,7 +115,7 @@ export function buildArgsWithDeprecations(args, deprecatedArgs, opts = {}) {* @param {string} [options.templateModule] - Module name for connector template.* @param {string} [options.connectorName] - Connector name.* @param {string} [options.layoutName] - Layout name.- * @returns {*} The value of the deprecated arg.+ * @returns {unknown} The value of the deprecated arg.* @throws {Error} If the deprecated arg was not created with `deprecatedOutletArgument`.*/export function deprecatedArgumentValue(deprecatedArg, options) {diff --git a/frontend/discourse/app/lib/post-bulk-select-helper.js b/frontend/discourse/app/lib/post-bulk-select-helper.jsindex eeb2da80203..c4ed5ed02ac 100644--- a/frontend/discourse/app/lib/post-bulk-select-helper.js+++ b/frontend/discourse/app/lib/post-bulk-select-helper.js@@ -3,6 +3,9 @@ import { action } from "@ember/object";import { getOwner, setOwner } from "@ember/owner";import { trackedArray } from "@ember/reactive/collections";+/**+ * @typedef {{ id?: number | string, post_id?: number, draft_key?: string }} SelectablePost+ *//*** Helper class for managing bulk selection of posts* Similar to BulkSelectHelper but specialized for posts@@ -15,8 +18,12 @@ import { trackedArray } from "@ember/reactive/collections";*/export default class PostBulkSelectHelper {@tracked loading = false;++ /** @type {SelectablePost | null} */@tracked lastClickedPost = null;@tracked bulkSelectEnabled = false;++ /** @type {SelectablePost[] | null} */@tracked posts = null;selected = trackedArray();@@ -33,6 +40,7 @@ export default class PostBulkSelectHelper {return this.selected.length > 0;}+ /** @returns {boolean | null} */get allSelected() {return this.posts && this.selected.length === this.posts.length;}diff --git a/frontend/discourse/app/lib/quote-state.js b/frontend/discourse/app/lib/quote-state.jsindex 59dbcfa0e3e..c9b8a4103e7 100644--- a/frontend/discourse/app/lib/quote-state.js+++ b/frontend/discourse/app/lib/quote-state.js@@ -2,9 +2,14 @@ import { tracked } from "@glimmer/tracking";import { waitForPromise } from "@ember/test-waiters";import toMarkdown from "discourse/lib/to-markdown";+/**+ * @typedef {{ full?: boolean, username?: string, post?: string | number, topic?: string | number }} QuoteOptions+ */export default class QuoteState {+ /** @type {string | number | null | undefined} */@tracked postId = null;+ /** @type {QuoteOptions | null | undefined} */#opts = null;#selectedHtml = null;#cookedHtml = null;@@ -20,6 +25,7 @@ export default class QuoteState {return template.content.textContent ?? "";}+ /** @returns {QuoteOptions | null | undefined} */get opts() {return this.#opts;}diff --git a/frontend/discourse/app/lib/sidebar/active-link.js b/frontend/discourse/app/lib/sidebar/active-link.jsindex 1fc1ac5c69a..5992097f275 100644--- a/frontend/discourse/app/lib/sidebar/active-link.js+++ b/frontend/discourse/app/lib/sidebar/active-link.js@@ -16,7 +16,7 @@* a route it does not know, and is not always a full router service — in* rendering tests it is a stand-in — so every lookup goes through here.*- * @param {Object} link+ * @param {{ currentWhen?: boolean | string, href?: string, value?: string, route?: string, model?: unknown, models?: unknown[], query?: Record<string, unknown> }} link* @param {RouterService} router* @returns {boolean}*/diff --git a/frontend/discourse/app/lib/sidebar/base-community-section-link.js b/frontend/discourse/app/lib/sidebar/base-community-section-link.jsindex e6193d33852..700aa99e321 100644--- a/frontend/discourse/app/lib/sidebar/base-community-section-link.js+++ b/frontend/discourse/app/lib/sidebar/base-community-section-link.js@@ -49,17 +49,17 @@ export default class BaseCommunitySectionLink {get href() {}/**- * @returns {Object} Model for <LinkTo> component. See https://api.emberjs.com/ember/release/classes/Ember.Templates.components/methods/LinkTo?anchor=LinkTo+ * @returns {string | number | object | null | undefined} Model for <LinkTo> component. See https://api.emberjs.com/ember/release/classes/Ember.Templates.components/methods/LinkTo?anchor=LinkTo*/get model() {}/**- * @returns {Object} Models for <LinkTo> component. See https://api.emberjs.com/ember/release/classes/Ember.Templates.components/methods/LinkTo?anchor=LinkTo+ * @returns {Array<string | number | object> | undefined} Models for <LinkTo> component. See https://api.emberjs.com/ember/release/classes/Ember.Templates.components/methods/LinkTo?anchor=LinkTo*/get models() {}/**- * @returns {Object} Query parameters for <LinkTo> component. See https://api.emberjs.com/ember/release/classes/Ember.Templates.components/methods/LinkTo?anchor=LinkTo+ * @returns {Record<string, unknown>} Query parameters for <LinkTo> component. See https://api.emberjs.com/ember/release/classes/Ember.Templates.components/methods/LinkTo?anchor=LinkTo*/get query() {return {};diff --git a/frontend/discourse/app/lib/sidebar/base-custom-sidebar-section-link.js b/frontend/discourse/app/lib/sidebar/base-custom-sidebar-section-link.jsindex bf796cbf658..34b6b618057 100644--- a/frontend/discourse/app/lib/sidebar/base-custom-sidebar-section-link.js+++ b/frontend/discourse/app/lib/sidebar/base-custom-sidebar-section-link.js@@ -27,12 +27,12 @@ export default class BaseCustomSidebarSectionLink {get href() {}/**- * @returns {Object} `model` argument for the <LinkTo> component. See https://api.emberjs.com/ember/release/classes/Ember.Templates.components/methods/LinkTo?anchor=LinkTo.+ * @returns {string | number | object | undefined} `model` argument for the <LinkTo> component. See https://api.emberjs.com/ember/release/classes/Ember.Templates.components/methods/LinkTo?anchor=LinkTo.*/get model() {}/**- * @returns {Object[]} `models` argument for the <LinkTo> component. See https://api.emberjs.com/ember/release/classes/Ember.Templates.components/methods/LinkTo?anchor=LinkTo.+ * @returns {Array<string | number | object> | undefined} `models` argument for the <LinkTo> component. See https://api.emberjs.com/ember/release/classes/Ember.Templates.components/methods/LinkTo?anchor=LinkTo.*/get models() {}@@ -76,7 +76,7 @@ export default class BaseCustomSidebarSectionLink {get badgeText() {}/**- * @returns {Object} Arguments to pass to the content component+ * @returns {Record<string, unknown> | undefined} Arguments to pass to the content component*/get contentComponentArgs() {}@@ -126,7 +126,7 @@ export default class BaseCustomSidebarSectionLink {get suffixComponent() {}/**- * @returns {Object} Arguments to pass to the suffix component+ * @returns {Record<string, unknown> | undefined} Arguments to pass to the suffix component*/get suffixArgs() {}diff --git a/frontend/discourse/app/lib/sidebar/custom-community-section-links.js b/frontend/discourse/app/lib/sidebar/custom-community-section-links.jsindex 41d41fbe352..74255020a25 100644--- a/frontend/discourse/app/lib/sidebar/custom-community-section-links.js+++ b/frontend/discourse/app/lib/sidebar/custom-community-section-links.js@@ -10,7 +10,7 @@ export let secondaryCustomSectionLinks = [];* @param {BaseCommunitySectionLink} baseCommunitySectionLink Factory class to inherit from.* @returns {BaseCommunitySectionLink} A class that extends BaseCommunitySectionLink.*- * @param {(addSectionLinkCallback|Object)} args - A callback function or an Object.+ * @param {((baseCommunitySectionLink: typeof BaseCommunitySectionLink) => typeof BaseCommunitySectionLink) | { name: string, text: string, route?: string, href?: string, title?: string, icon?: string, models?: Array<string | number | object> }} args - A callback function or an Object.* @param {string} args.name - The name of the link. Needs to be dasherized and lowercase.* @param {string} args.text - The text to display for the link.* @param {string} [args.route] - The Ember route name to generate the href attribute for the link.diff --git a/frontend/discourse/app/lib/sidebar/helpers.js b/frontend/discourse/app/lib/sidebar/helpers.jsindex 7d7dc42704c..c45f0b3a1aa 100644--- a/frontend/discourse/app/lib/sidebar/helpers.js+++ b/frontend/discourse/app/lib/sidebar/helpers.js@@ -1,5 +1,26 @@import Category from "discourse/models/category";+/**+ * @typedef {object} SidebarUrlData+ * @property {number} id+ * @property {string} name+ * @property {string} value+ * @property {string} icon+ * @property {boolean} external+ * @property {string} segment+ * @property {string | null} locale+ * @property {boolean} [can_localize]+ * @property {Array<{ id: number, sidebar_url_id: number, locale: string, name: string }>} [localizations]+ * @typedef {object} SidebarSectionData+ * @property {number} id+ * @property {string} title+ * @property {SidebarUrlData[]} links+ * @property {string} slug+ * @property {boolean} public+ * @property {"community" | null} section_type+ * @property {string | null} locale+ * @property {Array<{ id: number, sidebar_section_id: number, locale: string, title: string }>} [localizations]+ */export function canDisplayCategory(categoryId, siteSettings) {if (siteSettings.allow_uncategorized_topics) {return true;@@ -29,7 +50,7 @@ export function getCollapsedSidebarSectionKey(name) {* form applies its save, so the sidebar re-renders from them.** @param {User} user - The current user holding `sidebar_sections`.- * @param {Object[]} updatedSections - Serialized sections to swap in by id.+ * @param {SidebarSectionData[]} updatedSections - Serialized sections to swap in by id.*/export function replaceUserSidebarSections(user, updatedSections) {const sections = user.sidebar_sections.map((section) => {diff --git a/frontend/discourse/app/lib/sidebar/link-drop.js b/frontend/discourse/app/lib/sidebar/link-drop.jsindex 35dc48d9ec8..b7052fed39c 100644--- a/frontend/discourse/app/lib/sidebar/link-drop.js+++ b/frontend/discourse/app/lib/sidebar/link-drop.js@@ -15,7 +15,7 @@ export const WEB_LINK_KINDS = ["urls", "html", "text"];* answering `copy` makes the pair incompatible. The browser then refuses the* drop outright: no `drop` event, nothing logged.*- * @param {Object} source - The source a drop target reported.+ * @param {{ type?: string | null }} source - The source a drop target reported.* @returns {"move"|"copy"} The effect for this source.*/export function linkDropEffectFor(source) {@@ -54,7 +54,9 @@ export const WEB_LINK_ADOPTION = {* on `native`, because the rest of that source describes an element drag. Both* read the same from here on.*- * @param {Object} source - The source a drop target reported.+ * @template {object} T+ * @param {T & { native?: import("discourse/lib/-internals/drag-and-drop/external-vocabulary").ExternalDragPayload }} source - The source a drop target reported.+ * @returns {T | import("discourse/lib/-internals/drag-and-drop/external-vocabulary").ExternalDragPayload}*/export function webLinkPayload(source) {return source.native ?? source;@@ -70,8 +72,8 @@ export function webLinkPayload(source) {* reduced to its URLs. What is left here is deciding which candidate to take* and what to call it.*- * @param {Object} source - The decorated external drag payload.- * @returns {Object|undefined} A link ready for the section form.+ * @param {Pick<import("discourse/lib/-internals/drag-and-drop/external-vocabulary").ExternalDragPayload, "getHTML" | "getURLs" | "getText" | "getStringData"> | null | undefined} source - The decorated external drag payload.+ * @returns {{ icon: string, name: string, value: string, segment: "primary" } | undefined} A link ready for the section form.*/export function extractDroppedWebLink(source) {if (!source) {diff --git a/frontend/discourse/app/lib/sidebar/section.js b/frontend/discourse/app/lib/sidebar/section.jsindex 826e0ca32c0..20fca360915 100644--- a/frontend/discourse/app/lib/sidebar/section.js+++ b/frontend/discourse/app/lib/sidebar/section.js@@ -124,7 +124,7 @@ export default class Section {* Commits a dragged row's drop into this section: a drop from this very* section reorders it, one from another section transfers the link here.*- * @param {Object} dragData - The drag source's payload: `sectionId`,+ * @param {{ sectionId: number, linkId: number, public: boolean }} dragData - The drag source's payload: `sectionId`,* `linkId`, and whether the source section is `public`.* @param {number|undefined} dropIndex - The measured drop offset;* undefined appends.diff --git a/frontend/discourse/app/lib/string-similarity.js b/frontend/discourse/app/lib/string-similarity.jsindex ce84c1182dc..cef638b5aac 100644--- a/frontend/discourse/app/lib/string-similarity.js+++ b/frontend/discourse/app/lib/string-similarity.js@@ -150,7 +150,7 @@ export function findClosestMatch(input, candidates, options = {}) {** @param {string} value - The unknown/invalid value.* @param {readonly string[]} validValues - List of valid values to match against.- * @param {Object} [options] - Options passed to findClosestMatch.+ * @param {{ minSimilarity?: number, caseSensitive?: boolean }} [options] - Options passed to findClosestMatch.* @returns {string} Formatted string like '"foo" (did you mean "bar"?)' or just '"foo"'.** @examplediff --git a/frontend/discourse/app/lib/swipe-events.js b/frontend/discourse/app/lib/swipe-events.jsindex 89ea3f62aa9..05c069d2f88 100644--- a/frontend/discourse/app/lib/swipe-events.js+++ b/frontend/discourse/app/lib/swipe-events.js@@ -101,9 +101,26 @@ export const SWIPE_VELOCITY_THRESHOLD = 0.12;export const MINIMUM_SWIPE_DISTANCE = 5;export const MAX_ANIMATION_TIME = 200;+/**+ * @typedef {object} SwipeState+ * @property {{ x: number, y: number }} center+ * @property {{ x: number, y: number }} startLocation+ * @property {number} velocityX+ * @property {number} velocityY+ * @property {number} deltaX+ * @property {number} deltaY+ * @property {boolean} start+ * @property {number} timestamp+ * @property {"left" | "right" | "up" | "down" | null} direction+ * @property {HTMLElement} element+ * @property {() => boolean} goingUp+ * @property {() => boolean} goingDown+ * @property {TouchEvent} [originalEvent]+ */export default class SwipeEvents {//velocity is pixels per ms+ /** @type {SwipeState | null} */swipeState = null;animationPending = false;diff --git a/frontend/discourse/app/lib/text.js b/frontend/discourse/app/lib/text.jsindex ce03eecbff4..80ac0535cf5 100644--- a/frontend/discourse/app/lib/text.js+++ b/frontend/discourse/app/lib/text.js@@ -210,7 +210,7 @@ export function serializeBBCodeAttr(value, name) {/*** Builds a BBCode attributes string from an object of key-value pairs.*- * @param {Object} attrs - Object containing attribute key-value pairs+ * @param {Record<string, unknown>} attrs - Object containing attribute key-value pairs* @param {Object} [opts] - Options* @param {string[]} [opts.skipAttrs] - Array of attribute names to skip* @returns {string} The serialized attributes string (e.g., 'name=value foo="bar baz"')diff --git a/frontend/discourse/app/lib/theme-selector.js b/frontend/discourse/app/lib/theme-selector.jsindex 7e5d3437d9d..37b7f436912 100644--- a/frontend/discourse/app/lib/theme-selector.js+++ b/frontend/discourse/app/lib/theme-selector.js@@ -61,6 +61,22 @@ export function extendThemeCookie() {}}+/**+ * A theme the current user can choose. The site default has a `null` id when+ * no theme is marked as the default.+ *+ * @typedef {object} SelectableTheme+ * @property {string} name+ * @property {number | null} id+ * @property {number | null} [color_scheme_id]+ * @property {number | null} [dark_color_scheme_id]+ * @property {boolean} [only_theme_color_schemes]+ */++/**+ * @param {import("discourse/models/site").default} site+ * @returns {SelectableTheme[] | null}+ */export function listThemes(site) {let themes = site.get("user_themes");diff --git a/frontend/discourse/app/lib/time-shortcut.js b/frontend/discourse/app/lib/time-shortcut.jsindex 893c65d64b8..b1994b23150 100644--- a/frontend/discourse/app/lib/time-shortcut.js+++ b/frontend/discourse/app/lib/time-shortcut.js@@ -253,7 +253,7 @@ export function timeShortcuts(timezone) {icon: "arrow-rotate-left",id: TIME_SHORTCUT_TYPES.LAST_CUSTOM,label: "time_shortcut.last_custom",- time: null,+ time: /** @type {import("moment").Moment | null} */ (null),hidden: true,};},diff --git a/frontend/discourse/app/lib/tracked-tools.js b/frontend/discourse/app/lib/tracked-tools.jsindex 7476c93098d..30300c62cb4 100644--- a/frontend/discourse/app/lib/tracked-tools.js+++ b/frontend/discourse/app/lib/tracked-tools.js@@ -39,8 +39,9 @@ export function defineTrackedProperty(target, key, value) {* 1. Registers `setCustomTagFor` so `tagForProperty()` bypasses `setupMandatorySetter`* 2. Intercepts `set` to also call `dirtyTagFor()` for classic chain tag invalidation*- * @param {Object} obj - The object to wrap in a tracked proxy.- * @returns {Proxy} A proxy that supports both native autotracking and classic `@computed` chains.+ * @template {object} T+ * @param {T} obj - The object to wrap in a tracked proxy.+ * @returns {T} A proxy that supports both native autotracking and classic `@computed` chains.*/export function trackedObjectWithComputedSupport(obj) {const inner = trackedObject(obj);@@ -269,10 +270,10 @@ function ensureTrackedArray(value, propertyName) {* @decorator* Same as `@tracked`, but initializes the value as a TrackedArray.*- * @param {Object} target - The target object- * @param {string|Symbol} key - The property key- * @param {Object} desc - The property descriptor- * @returns {Object} Modified property descriptor that wraps arrays in TrackedArray+ * @param {object} target - The target object+ * @param {string|symbol} key - The property key+ * @param {{ initializer?: () => unknown, get?: () => unknown, set?: (value: unknown) => void, value?: unknown, writable?: boolean, enumerable?: boolean, configurable?: boolean }} desc - The property descriptor+ * @returns {{ get: () => unknown, set: (value: unknown) => void, enumerable: boolean, configurable: boolean, isTracked: boolean }} Modified property descriptor that wraps arrays in TrackedArray** @example* class TodoList {@@ -356,7 +357,7 @@ export { autoTrackedArray as trackedArray };* **Warning:** This function uses Ember internal APIs (`peekMeta`, `TrackedDescriptor`)* which are not part of the public API and may change without notice in future Ember versions.*- * @param {Object} obj - The object instance to enumerate tracked keys from+ * @param {object | null | undefined} obj - The object instance to enumerate tracked keys from* @returns {Array<string>} An array of tracked property keys.* Returns an empty array if the object has no prototype or no tracked properties.*@@ -404,8 +405,8 @@ export function enumerateTrackedKeys(obj) {* **Warning:** This function uses Ember internal APIs (`peekMeta`, `TrackedDescriptor`)* which are not part of the public API and may change without notice in future Ember versions.*- * @param {Object} obj - The object instance to enumerate tracked entries from- * @returns {Array<[string, any]>} An array of [key, value] pairs for all tracked properties.+ * @param {object | null | undefined} obj - The object instance to enumerate tracked entries from+ * @returns {Array<[string, unknown]>} An array of [key, value] pairs for all tracked properties.* Returns an empty array if the object has no prototype or no tracked properties.** @examplediff --git a/frontend/discourse/app/lib/user-status-message.js b/frontend/discourse/app/lib/user-status-message.jsindex b9c8310269d..dc9edc0ae53 100644--- a/frontend/discourse/app/lib/user-status-message.js+++ b/frontend/discourse/app/lib/user-status-message.js@@ -8,7 +8,10 @@ import User from "discourse/models/user";export class UserStatusMessage {@service tooltip;+ /** @type {HTMLSpanElement | null} */html = null;++ /** @type {HTMLDivElement | null} */content = null;constructor(owner, status, opts) {diff --git a/frontend/discourse/app/lib/username-validation-helper.js b/frontend/discourse/app/lib/username-validation-helper.jsindex 0ca567e4eea..6338eb4f88b 100644--- a/frontend/discourse/app/lib/username-validation-helper.js+++ b/frontend/discourse/app/lib/username-validation-helper.js@@ -20,6 +20,8 @@ function validResult(attrs) {export default class UsernameValidationHelper {@tracked usernameValidationResult;++ /** @type {string | null | undefined} */checkedUsername = null;constructor({diff --git a/frontend/discourse/app/lib/webauthn.js b/frontend/discourse/app/lib/webauthn.jsindex 6f8cb64de69..12d1b23caf6 100644--- a/frontend/discourse/app/lib/webauthn.js+++ b/frontend/discourse/app/lib/webauthn.js@@ -21,6 +21,7 @@ export function isWebauthnSupported() {// The webauthn API only supports one auth attempt at a time// We need this service to cancel the previous attempt when a new one is startedclass WebauthnAbortService {+ /** @type {AbortController | undefined} */controller = undefined;signal() {diff --git a/frontend/discourse/app/lib/wrap-utils.js b/frontend/discourse/app/lib/wrap-utils.jsindex c98b1dfb6ed..4c5773f62e4 100644--- a/frontend/discourse/app/lib/wrap-utils.js+++ b/frontend/discourse/app/lib/wrap-utils.js@@ -4,7 +4,7 @@ import { parseBBCodeTag } from "discourse-markdown-it/features/bbcode-block";/*** Parse an attributes string into flat object (matches server behavior)* @param {string} attrsString - The attributes string to parse- * @returns {Object} Flat object like {wrap: "toc", id: "123"}+ * @returns {Record<string, string>} Flat object like {wrap: "toc", id: "123"}*/export function parseAttributesString(attrsString) {if (!attrsString.trim()) {@@ -25,7 +25,7 @@ export function parseAttributesString(attrsString) {/*** Serialize flat object back to BBCode format- * @param {Object} data - Flat object like {wrap: "toc", id: "123"}+ * @param {Record<string, string | number | boolean | null | undefined> | null | undefined} data - Flat object like {wrap: "toc", id: "123"}* @returns {string} Serialized attributes string*/export function serializeAttributes(data) {diff --git a/frontend/discourse/app/modifiers/post-stream-viewport-tracker.js b/frontend/discourse/app/modifiers/post-stream-viewport-tracker.jsindex 4d5423ef7d4..2b8799b440f 100644--- a/frontend/discourse/app/modifiers/post-stream-viewport-tracker.js+++ b/frontend/discourse/app/modifiers/post-stream-viewport-tracker.js@@ -198,7 +198,7 @@ export default class PostStreamViewportTracker {/*** Map of post numbers to their post models and DOM elements that are currently on screen* Used to track which posts are visible in the viewport for eyeline calculations and screen tracking- * @type {Object<number, {post: Object, element: HTMLElement}>}+ * @type {Record<number, {post: import("discourse/models/post").default, element: HTMLElement}>}* @private*/#postsOnScreen = {};@@ -406,7 +406,7 @@ export default class PostStreamViewportTracker {/*** Returns a map of post numbers to their post models and DOM elements that are currently on screen- * @returns {Object<number, {post: Object, element: HTMLElement}>} Map of visible posts+ * @returns {Record<number, {post: import("discourse/models/post").default, element: HTMLElement}>} Map of visible posts*/get postsOnScreen() {return this.#postsOnScreen;@@ -522,12 +522,11 @@ export default class PostStreamViewportTracker {* Determines if a post should be cloaked based on its position relative to the viewport boundaries* Returns an object containing cloaking state and optional height style when cloaking is active*- * @param {Object} post - The post model+ * @param {import("discourse/models/post").default | null | undefined} post - The post model* @param {Object} options - Cloaking boundary options* @param {number} options.above - The minimum post number to keep visible* @param {number} options.below - The maximum post number to keep visible- * @returns {Object} Object with active boolean and optional style string- * {active: boolean, style?: string}+ * @returns {{ active: boolean, style?: import("@ember/template").TrustedHTML }} Object with active boolean and optional style*/@bindgetCloakingData(post, { above, below }) {diff --git a/frontend/discourse/app/static/codemirror/components/codemirror-editor.gjs b/frontend/discourse/app/static/codemirror/components/codemirror-editor.gjsindex d685e5e9107..3c52c87a8b0 100644--- a/frontend/discourse/app/static/codemirror/components/codemirror-editor.gjs+++ b/frontend/discourse/app/static/codemirror/components/codemirror-editor.gjs@@ -18,6 +18,7 @@ import { bind } from "discourse/lib/decorators";import { buildCmParams } from "../build-extensions.js";export default class CodemirrorEditor extends Component {+ /** @type {import("@codemirror/view").EditorView | null} */@tracked view = null;#lastValue;#suppressChange = false;diff --git a/frontend/discourse/app/static/dev-tools/shared/args-table.gjs b/frontend/discourse/app/static/dev-tools/shared/args-table.gjsindex 86efc0f69a4..fa98753fcc4 100644--- a/frontend/discourse/app/static/dev-tools/shared/args-table.gjs+++ b/frontend/discourse/app/static/dev-tools/shared/args-table.gjs@@ -27,7 +27,7 @@ export default class ArgsTable extends Component {* Transforms the raw args object into an array of entry objects for display.* Each entry contains the original key/value plus formatted display representations.*- * @returns {Array<{key: string, value: any, displayValue: string, typeInfo: string, isDeprecated: boolean, deprecationInfo: Object|null}>}+ * @returns {Array<{key: string, value: unknown, displayValue: string, typeInfo: string, isDeprecated: boolean, deprecationInfo: {message: string | undefined, since: string | undefined}|null}>}*/get entries() {const entries = [];diff --git a/frontend/discourse/app/static/prosemirror/lib/plugin-utils.js b/frontend/discourse/app/static/prosemirror/lib/plugin-utils.jsindex b91160b6864..639b6365d5e 100644--- a/frontend/discourse/app/static/prosemirror/lib/plugin-utils.js+++ b/frontend/discourse/app/static/prosemirror/lib/plugin-utils.js@@ -171,7 +171,7 @@ export function changedDescendants(old, cur, f, offset = 0) {* @param type* {import("prosemirror-model").MarkType} - The type of mark to find.* @param attrs- * {Object} - Optional attributes to match against the mark.+ * {Record<string, unknown>} - Optional attributes to match against the mark.* @returns {{ from: number, to: number, mark: import("prosemirror-model").Mark } | undefined}*/export function getMarkRange($pos, type, attrs = {}) {@@ -224,7 +224,7 @@ export function getMarkRange($pos, type, attrs = {}) {* @param type* {import("prosemirror-model").MarkType} - The type of mark to find.* @param attrs- * {Object} - Optional attributes to match against the mark.+ * {Record<string, unknown>} - Optional attributes to match against the mark.* @returns {import("prosemirror-model").Mark | undefined}*/export function findMarkOfType(marks, type, attrs = {}) {diff --git a/frontend/discourse/app/static/wizard/models/wizard.js b/frontend/discourse/app/static/wizard/models/wizard.jsindex 262fe3d0382..2b90ad3ce3d 100644--- a/frontend/discourse/app/static/wizard/models/wizard.js+++ b/frontend/discourse/app/static/wizard/models/wizard.js@@ -173,8 +173,11 @@ export class Field {});}+ /** @type {string | null} */@tracked _value = null;@tracked _validState = ValidStates.UNCHECKED;++ /** @type {string | null | undefined} */@tracked _errorDescription = null;_listeners = [];@@ -195,6 +198,7 @@ export class Field {]);}+ /** @returns {string | null} */get value() {return this._value;}@@ -216,6 +220,7 @@ export class Field {this._errorDescription = null;}+ /** @returns {string | null | undefined} */get errorDescription() {return this._errorDescription;}diff --git a/frontend/discourse/app/templates/preferences/calendar-subscriptions.gjs b/frontend/discourse/app/templates/preferences/calendar-subscriptions.gjsindex e493d04569f..f13e0435dc4 100644--- a/frontend/discourse/app/templates/preferences/calendar-subscriptions.gjs+++ b/frontend/discourse/app/templates/preferences/calendar-subscriptions.gjs@@ -15,7 +15,10 @@ import { i18n } from "discourse-i18n";export default class CalendarSubscriptions extends Component {@service dialog;+ /** @type {boolean | null} */@tracked hasSubscription = null;++ /** @type {({ bookmarks: string } & Record<string, string>) | null} */@tracked urls = null;@tracked loading = false;diff --git a/frontend/discourse/tests/helpers/deprecation-counter.js b/frontend/discourse/tests/helpers/deprecation-counter.jsindex 69c7f8181c0..d13c5b780e5 100644--- a/frontend/discourse/tests/helpers/deprecation-counter.js+++ b/frontend/discourse/tests/helpers/deprecation-counter.js@@ -201,7 +201,7 @@ export default class DeprecationCounter {* Hands over entries whose count has grown since they were first reported, so* the reporter can correct the totals it already holds.*- * @returns {Object[]}+ * @returns {Array<{ key: string, count: number }>}*/takeUpdatedCounts() {const updated = Array.from(this.#countsChanged, (key) =>diff --git a/frontend/discourse/tests/helpers/form-kit-helper.js b/frontend/discourse/tests/helpers/form-kit-helper.jsindex 31a481391b4..84ed2eb9b96 100644--- a/frontend/discourse/tests/helpers/form-kit-helper.js+++ b/frontend/discourse/tests/helpers/form-kit-helper.js@@ -333,7 +333,7 @@ class Field {* Triggers any event on the input element of the field.** @param {string} eventName - The name of the event to trigger.- * @param {Object} [options={}] - Additional options for the event.+ * @param {Record<string, unknown>} [options={}] - Additional options for the event.*/async triggerEvent(eventName, options = {}) {await triggerEvent(this.inputElement, eventName, options);