Skip to content

A platform for community discussion. Free, open, simple.

DEV: Type strict-narrowed members in app components (#44655)

Sérgio Saquetim95afeaa9ba1f
diff --git a/frontend/discourse/app/components/ace-editor.gjs b/frontend/discourse/app/components/ace-editor.gjs
index 47ee555fe48..19708672466 100644
--- a/frontend/discourse/app/components/ace-editor.gjs
+++ b/frontend/discourse/app/components/ace-editor.gjs
@@ -63,9 +63,16 @@ export default class AceEditor extends Component {
@tracked isLoading = true;
- /** The resized box, handed to the separator once the editor has built it. */
+ /**
+ * The resized box, handed to the separator once the editor has built it.
+ * @type {HTMLElement | null}
+ */
@tracked editorContainer = null;
+
+ /** @type {import("ace-builds").Ace.Editor | null} */
editor = null;
+
+ /** @type {typeof import("ace-builds") | null} */
ace = null;
skipChangePropagation = false;
diff --git a/frontend/discourse/app/components/bookmark-menu.gjs b/frontend/discourse/app/components/bookmark-menu.gjs
index 6bdecab3c2e..c881658a428 100644
--- a/frontend/discourse/app/components/bookmark-menu.gjs
+++ b/frontend/discourse/app/components/bookmark-menu.gjs
@@ -30,6 +30,8 @@ export default class BookmarkMenu extends Component {
timezone = this.currentUser?.user_option?.timezone || moment.tz.guess();
timeShortcuts = timeShortcuts(this.timezone);
+
+ /** @type {Promise<void> | null} */
bookmarkCreatePromise = null;
get bookmarkManager() {
diff --git a/frontend/discourse/app/components/bulk-actions/notification-level.gjs b/frontend/discourse/app/components/bulk-actions/notification-level.gjs
index 1984fcafddf..46864136490 100644
--- a/frontend/discourse/app/components/bulk-actions/notification-level.gjs
+++ b/frontend/discourse/app/components/bulk-actions/notification-level.gjs
@@ -9,6 +9,7 @@ import { i18n } from "discourse-i18n";
// Support for changing the notification level of various topics
export default class NotificationLevel extends Component {
+ /** @type {string | null | undefined} */
notificationLevelId = null;
@computed("notificationLevelId")
diff --git a/frontend/discourse/app/components/card-contents-base.js b/frontend/discourse/app/components/card-contents-base.js
index 3673a83ed5f..1effd01154f 100644
--- a/frontend/discourse/app/components/card-contents-base.js
+++ b/frontend/discourse/app/components/card-contents-base.js
@@ -37,19 +37,32 @@ export default class CardContentsBase extends Component {
@service siteSettings;
canShowWhenUserProfilesHidden = false;
+
+ /** @type {string | null} */
elementId = null; //click detection added for data-{elementId}
eventPrefix = "user-card";
menuIdentifier = "usercard";
showCardBeforeLoad = true;
+
+ /** @type {string | null} */
triggeringLinkSelector = null;
visible = false;
+
+ /** @type {string | null} */
username = null;
+
+ /** @type {string | boolean | null} */
loading = null;
+
+ /** @type {HTMLElement | null} */
cardTarget = null;
+
+ /** @type {import("discourse/models/post").default | null | undefined} */
post = null;
isDocked = false;
+ /** @type {import("discourse/float-kit/lib/d-menu-instance").default | null | undefined} */
_menuInstance = null;
@computed("topic.postStream")
diff --git a/frontend/discourse/app/components/category-card-contents.gjs b/frontend/discourse/app/components/category-card-contents.gjs
index 69a02bd12b0..fb95fc8ae49 100644
--- a/frontend/discourse/app/components/category-card-contents.gjs
+++ b/frontend/discourse/app/components/category-card-contents.gjs
@@ -63,10 +63,16 @@ export default class CategoryCardContents extends CardContentsBase {
avatarDataAttrKey = "id";
avatarSelector = CATEGORY_HASHTAG_SELECTOR;
canShowWhenUserProfilesHidden = true;
+
+ /** @type {import("discourse/models/category").default | null} */
category = null;
+
+ /** @type {string | number | null} */
categoryId = null;
elementId = "category-card";
eventPrefix = null;
+
+ /** @type {import("discourse/models/topic").default[] | null} */
latestTopics = null;
menuIdentifier = "category-card";
mentionSelector = CATEGORY_HASHTAG_SELECTOR;
diff --git a/frontend/discourse/app/components/category-list-item.js b/frontend/discourse/app/components/category-list-item.js
index 0630518e337..16c27c024e7 100644
--- a/frontend/discourse/app/components/category-list-item.js
+++ b/frontend/discourse/app/components/category-list-item.js
@@ -17,6 +17,7 @@ const LIST_TYPE = {
export default class CategoryListItem extends Component {
@service discovery;
+ /** @type {import("discourse/models/category").default | null} */
category = null;
listType = LIST_TYPE.NORMAL;
diff --git a/frontend/discourse/app/components/choose-message.gjs b/frontend/discourse/app/components/choose-message.gjs
index a8fcbb42bd7..5081ed9abfb 100644
--- a/frontend/discourse/app/components/choose-message.gjs
+++ b/frontend/discourse/app/components/choose-message.gjs
@@ -11,6 +11,7 @@ import DAsyncContent from "discourse/ui-kit/d-async-content";
import { i18n } from "discourse-i18n";
export default class ChooseMessage extends Component {
+ /** @type {string | null} */
@tracked messageTitle = null;
@action
diff --git a/frontend/discourse/app/components/choose-topic.gjs b/frontend/discourse/app/components/choose-topic.gjs
index 951a1d040fa..c8efd719462 100644
--- a/frontend/discourse/app/components/choose-topic.gjs
+++ b/frontend/discourse/app/components/choose-topic.gjs
@@ -22,6 +22,7 @@ import { i18n } from "discourse-i18n";
// label
// loadOnInit
export default class ChooseTopic extends Component {
+ /** @type {string | null} */
@tracked topicTitle = null;
async initialSearch() {
diff --git a/frontend/discourse/app/components/composer-messages.gjs b/frontend/discourse/app/components/composer-messages.gjs
index 371201aa927..a5b1c474c64 100644
--- a/frontend/discourse/app/components/composer-messages.gjs
+++ b/frontend/discourse/app/components/composer-messages.gjs
@@ -36,19 +36,36 @@ function visibleMessages(messages) {
return messages?.content?.filter((msg) => msg.id !== "education") || [];
}
+/**
+ * @typedef {import("discourse/models/rest").default & { id: number, topic: import("discourse/models/topic").default, blurb: string, created_at: string, url: string }} SimilarComposerTopic
+ * @typedef {EmberObject & { id?: string, templateName: string, extraClass?: string, title?: string, body?: string | import("@ember/template").TrustedHTML, wait_for_typing?: boolean, hide_if_whisper?: boolean, reply_username?: string | null, similarTopics?: SimilarComposerTopic[] }} ComposerPopupMessage
+ */
@tagName("")
export default class ComposerMessages extends Component {
@tracked showShareModal;
+
+ /** @type {SimilarComposerTopic[] | null} */
@autoTrackedArray similarTopics = null;
+
+ /** @type {ComposerPopupMessage[] | null} */
@autoTrackedArray messages = null;
checkedMessages = false;
+
+ /** @type {Record<string, ComposerPopupMessage | undefined> | null} */
messagesByTemplate = null;
+
+ /** @type {ComposerPopupMessage[] | null} */
queuedForTyping = null;
+
+ /** @type {string | null} */
usersNotSeen = null;
recipientNames = [];
+ /** @type {string | null} */
_lastSimilaritySearch = null;
+
+ /** @type {ComposerPopupMessage | null} */
_similarTopicsMessage = null;
@computed("composer.viewOpenOrFullscreen")
diff --git a/frontend/discourse/app/components/dialog-messages/confirm-session.gjs b/frontend/discourse/app/components/dialog-messages/confirm-session.gjs
index 5ea3ee4459e..dabb992ead3 100644
--- a/frontend/discourse/app/components/dialog-messages/confirm-session.gjs
+++ b/frontend/discourse/app/components/dialog-messages/confirm-session.gjs
@@ -21,6 +21,8 @@ export default class ConfirmSession extends Component {
@service siteSettings;
@tracked errorMessage;
+
+ /** @type {string | null} */
@tracked resetEmailSent = null;
@tracked isLoading = false;
diff --git a/frontend/discourse/app/components/discovery/filter-navigation-menu.gjs b/frontend/discourse/app/components/discovery/filter-navigation-menu.gjs
index adcbcd86104..10ae885f9c4 100644
--- a/frontend/discourse/app/components/discovery/filter-navigation-menu.gjs
+++ b/frontend/discourse/app/components/discovery/filter-navigation-menu.gjs
@@ -49,6 +49,9 @@ const FilterNavigationMenuList = <template>
{{/if}}
</template>;
+/**
+ * @typedef {{ name: string, description?: string, category?: import("discourse/models/category").default, term?: string, isSuggestion?: boolean, delimiters?: { name: string, description?: string }[], alias?: string, type?: string, priority?: number, prefixes?: { name: string, description?: string }[], extra_entries?: { name: string, description: string }[], min?: number }} FilterSuggestion
+ */
/**
* FilterNavigationMenu - A simpler UI component for filter input and suggestions
*
@@ -65,20 +68,30 @@ export default class FilterNavigationMenu extends Component {
@service site;
@tracked currentInputValue = this.args.initialInputValue || "";
+
+ /** @type {FilterSuggestion[]} */
@tracked suggestions = [];
+
+ /** @type {string | null} */
@tracked activeFilter = null;
lastSuggestionInput = "";
suggestionRequestId = 0;
+ /** @type {{ suggestions: FilterSuggestion[], selectedIndex: number | null, selectItem: FilterNavigationMenu["selectItem"] }} */
trackedMenuListData = trackedObject({
suggestions: [],
selectedIndex: null,
selectItem: this.selectItem,
});
+ /** @type {import("@ember/runloop").Timer | null} */
searchTimer = null;
+
+ /** @type {HTMLInputElement | null} */
inputElement = null;
+
+ /** @type {import("discourse/float-kit/lib/d-menu-instance").default | null | undefined} */
dMenuInstance = null;
_selectedIndex = -1;
diff --git a/frontend/discourse/app/components/docked-composer.gjs b/frontend/discourse/app/components/docked-composer.gjs
index 075a3ec1a72..daf0521d5b2 100644
--- a/frontend/discourse/app/components/docked-composer.gjs
+++ b/frontend/discourse/app/components/docked-composer.gjs
@@ -42,8 +42,13 @@ export default class DockedComposer extends Component {
@tracked reply = "";
@tracked uploads = trackedArray();
+ /** @type {HTMLElement | null} */
inputElement = null;
+
+ /** @type {import("discourse/lib/uppy/uppy-upload").default | null} */
uppyUpload = null;
+
+ /** @type {HTMLInputElement | null} */
fileInputEl = null;
#rootElement = null;
diff --git a/frontend/discourse/app/components/embed-mode-composer.gjs b/frontend/discourse/app/components/embed-mode-composer.gjs
index 535b174350b..e7c6731fb9a 100644
--- a/frontend/discourse/app/components/embed-mode-composer.gjs
+++ b/frontend/discourse/app/components/embed-mode-composer.gjs
@@ -18,7 +18,10 @@ export default class EmbedModeComposer extends Component {
@service site;
@service store;
+ /** @type {import("discourse/models/post").default | null} */
@tracked replyingToPost = null;
+
+ /** @type {import("discourse/models/post").default | null} */
@tracked editingPost = null;
@tracked isSubmitting = false;
@tracked footerVisible = true;
diff --git a/frontend/discourse/app/components/ember-text-field.gjs b/frontend/discourse/app/components/ember-text-field.gjs
index ac1fdc01244..6989c814bfd 100644
--- a/frontend/discourse/app/components/ember-text-field.gjs
+++ b/frontend/discourse/app/components/ember-text-field.gjs
@@ -112,16 +112,22 @@ const TextField = Component.extend({
},
}),
+ /** @type {string | number | null | undefined} */
size: null,
+ /** @type {string | null | undefined} */
pattern: null,
+ /** @type {string | number | null | undefined} */
min: null,
+ /** @type {string | number | null | undefined} */
max: null,
+ /** @type {string | null | undefined} */
placeholder: null,
disabled: false,
+ /** @type {string | number | null | undefined} */
maxlength: null,
init() {
diff --git a/frontend/discourse/app/components/emoji-picker/content.gjs b/frontend/discourse/app/components/emoji-picker/content.gjs
index 43be4aa3543..caff1e8d375 100644
--- a/frontend/discourse/app/components/emoji-picker/content.gjs
+++ b/frontend/discourse/app/components/emoji-picker/content.gjs
@@ -59,6 +59,8 @@ export default class EmojiPicker extends Component {
@service siteSettings;
@tracked isFiltering = false;
+
+ /** @type {{ name: string, tonable: boolean }[] | null} */
@tracked filteredEmojis = null;
@tracked scrollObserverEnabled = true;
@tracked scrollDirection = "up";
diff --git a/frontend/discourse/app/components/emoji-picker/diversity-menu.gjs b/frontend/discourse/app/components/emoji-picker/diversity-menu.gjs
index cb73cabc3db..68de62c30d1 100644
--- a/frontend/discourse/app/components/emoji-picker/diversity-menu.gjs
+++ b/frontend/discourse/app/components/emoji-picker/diversity-menu.gjs
@@ -8,6 +8,7 @@ import DButton from "discourse/ui-kit/d-button";
import DDropdownMenu from "discourse/ui-kit/d-dropdown-menu";
import dReplaceEmoji from "discourse/ui-kit/helpers/d-replace-emoji";
+/** @type {{ scale: number | null, modifier: string }[]} */
export const FITZPATRICK_MODIFIERS = [
{ scale: null, modifier: "" },
{ scale: 2, modifier: ":t1" },
diff --git a/frontend/discourse/app/components/emoji-picker/index.gjs b/frontend/discourse/app/components/emoji-picker/index.gjs
index a3b313bbe4a..85a4b2c7fb0 100644
--- a/frontend/discourse/app/components/emoji-picker/index.gjs
+++ b/frontend/discourse/app/components/emoji-picker/index.gjs
@@ -9,6 +9,7 @@ import dIcon from "discourse/ui-kit/helpers/d-icon";
import dReplaceEmoji from "discourse/ui-kit/helpers/d-replace-emoji";
export default class EmojiPicker extends Component {
+ /** @type {import("discourse/float-kit/lib/d-menu-instance").default | null} */
@tracked menu = null;
get icon() {
diff --git a/frontend/discourse/app/components/empty-topic-filter.gjs b/frontend/discourse/app/components/empty-topic-filter.gjs
index 644db82a38e..b9261d52a76 100644
--- a/frontend/discourse/app/components/empty-topic-filter.gjs
+++ b/frontend/discourse/app/components/empty-topic-filter.gjs
@@ -23,6 +23,7 @@ export default class EmptyTopicFilter extends Component {
}
}
+ /** @returns {{ action: (() => void) | null, label: string }} */
get ctaLabelWithAction() {
if (this.currentUser.unified_new_enabled) {
if (this.args.newListSubset === "topics") {
diff --git a/frontend/discourse/app/components/form-template-field/wrapper.gjs b/frontend/discourse/app/components/form-template-field/wrapper.gjs
index cdd8abc2e81..a2a0579f001 100644
--- a/frontend/discourse/app/components/form-template-field/wrapper.gjs
+++ b/frontend/discourse/app/components/form-template-field/wrapper.gjs
@@ -31,7 +31,10 @@ export default class FormTemplateFieldWrapper extends Component {
@service composer;
@service siteSettings;
+ /** @type {unknown} */
@tracked error = null;
+
+ /** @type {unknown} */
@tracked parsedTemplate = null;
initialValues = this.args.initialValues ?? {};
diff --git a/frontend/discourse/app/components/global-notice.gjs b/frontend/discourse/app/components/global-notice.gjs
index 29734279ea9..19f27daf2ff 100644
--- a/frontend/discourse/app/components/global-notice.gjs
+++ b/frontend/discourse/app/components/global-notice.gjs
@@ -21,9 +21,25 @@ export function addGlobalNotice(text, id, options = {}) {
const GLOBAL_NOTICE_DISMISSED_PROMPT_KEY = "dismissed-global-notice-v2";
+/**
+ * @typedef {object} NoticeOptions
+ * @property {boolean} [dismissable]
+ * @property {string | null} [html]
+ * @property {string} [level]
+ * @property {boolean} [persistentDismiss]
+ * @property {((notice: Notice) => void) | null} [onDismiss]
+ * @property {((notice: Notice) => boolean) | null} [visibility]
+ * @property {import("moment").Duration | null} [dismissDuration]
+ */
+
class Notice extends EmberObject {
+ /** @type {string | import("@ember/template").TrustedHTML | null} */
text = null;
+
+ /** @type {string | null} */
id = null;
+
+ /** @type {NoticeOptions | null} */
options = null;
init() {
@@ -59,6 +75,7 @@ export default class GlobalNotice extends Component {
@service("logsNotice") logsNoticeService;
@service router;
+ /** @type {Notice | null} */
logNotice = null;
constructor() {
diff --git a/frontend/discourse/app/components/group-card-contents.gjs b/frontend/discourse/app/components/group-card-contents.gjs
index 253f9e3e01a..e27be6b6f19 100644
--- a/frontend/discourse/app/components/group-card-contents.gjs
+++ b/frontend/discourse/app/components/group-card-contents.gjs
@@ -32,6 +32,7 @@ export default class GroupCardContents extends CardContentsBase {
avatarDataAttrKey = "groupCard";
mentionSelector = "a.mention-group";
+ /** @type {import("discourse/models/group").default | null} */
group = null;
@computed("topic.postStream")
diff --git a/frontend/discourse/app/components/group-manage-save-button.gjs b/frontend/discourse/app/components/group-manage-save-button.gjs
index 1b4d540bd59..1fd9329c11b 100644
--- a/frontend/discourse/app/components/group-manage-save-button.gjs
+++ b/frontend/discourse/app/components/group-manage-save-button.gjs
@@ -20,6 +20,7 @@ export default class GroupManageSaveButton extends Component {
@service router;
@service groupAutomaticMembersDialog;
+ /** @type {boolean | null} */
saving = null;
disabled = false;
diff --git a/frontend/discourse/app/components/groups-form-profile-fields.gjs b/frontend/discourse/app/components/groups-form-profile-fields.gjs
index 9bbc51af534..a117b17e3f8 100644
--- a/frontend/discourse/app/components/groups-form-profile-fields.gjs
+++ b/frontend/discourse/app/components/groups-form-profile-fields.gjs
@@ -17,7 +17,10 @@ import { i18n } from "discourse-i18n";
@tagName("")
export default class GroupsFormProfileFields extends Component {
+ /** @type {boolean | null} */
disableSave = null;
+
+ /** @type {string | null | undefined} */
nameInput = null;
@computed("model.automatic")
diff --git a/frontend/discourse/app/components/invite-panel.gjs b/frontend/discourse/app/components/invite-panel.gjs
index afd39533f72..4c4b7e042af 100644
--- a/frontend/discourse/app/components/invite-panel.gjs
+++ b/frontend/discourse/app/components/invite-panel.gjs
@@ -25,14 +25,20 @@ export default class InvitePanel extends Component {
// scope to allowed usernames
+ /** @type {number[] | null} */
groupIds = null;
+
+ /** @type {{ id: number, name: string, automatic: boolean }[] | null} */
allGroups = null;
// invitee is either a user, group or email
+ /** @type {string | null} */
invitee = null;
isInviteeGroup = false;
hasCustomMessage = false;
+
+ /** @type {string | null} */
customMessage = null;
inviteIcon = "envelope";
invitingExistingUserToTopic = false;
diff --git a/frontend/discourse/app/components/language-switcher.gjs b/frontend/discourse/app/components/language-switcher.gjs
index 8c699a11359..cd2d51d31b9 100644
--- a/frontend/discourse/app/components/language-switcher.gjs
+++ b/frontend/discourse/app/components/language-switcher.gjs
@@ -20,6 +20,7 @@ export default class LanguageSwitcher extends Component {
@service languageNameLookup;
@service currentUser;
+ /** @returns {string | null} */
get currentLocale() {
return I18n.locale;
}
diff --git a/frontend/discourse/app/components/mobile-nav.gjs b/frontend/discourse/app/components/mobile-nav.gjs
index 15ce3cd8a66..c648997e63e 100644
--- a/frontend/discourse/app/components/mobile-nav.gjs
+++ b/frontend/discourse/app/components/mobile-nav.gjs
@@ -13,6 +13,7 @@ export default class MobileNav extends Component {
@service router;
@service site;
+ /** @type {string | null} */
@tracked selectedHtml = null;
@tracked expanded = false;
diff --git a/frontend/discourse/app/components/modal/auth-token.gjs b/frontend/discourse/app/components/modal/auth-token.gjs
index 7bf13747de9..5ffa36cee36 100644
--- a/frontend/discourse/app/components/modal/auth-token.gjs
+++ b/frontend/discourse/app/components/modal/auth-token.gjs
@@ -18,6 +18,8 @@ export default class AuthTokenComponent extends Component {
@service currentUser;
@tracked expanded = false;
+
+ /** @type {{ cooked: string, excerpt: string } | null} */
@tracked latestPost = null;
constructor() {
diff --git a/frontend/discourse/app/components/modal/avatar-selector.gjs b/frontend/discourse/app/components/modal/avatar-selector.gjs
index ed96b2e5001..7f9e191d611 100644
--- a/frontend/discourse/app/components/modal/avatar-selector.gjs
+++ b/frontend/discourse/app/components/modal/avatar-selector.gjs
@@ -45,6 +45,8 @@ export default class AvatarSelectorModal extends Component {
@tracked gravatarRefreshDisabled = false;
@tracked gravatarFailed = false;
+
+ /** @type {string | null} */
@tracked _selected = null;
@tracked _pendingFile;
@tracked _filePreview;
diff --git a/frontend/discourse/app/components/modal/bookmark.gjs b/frontend/discourse/app/components/modal/bookmark.gjs
index 15c89bb45f2..a5e50655920 100644
--- a/frontend/discourse/app/components/modal/bookmark.gjs
+++ b/frontend/discourse/app/components/modal/bookmark.gjs
@@ -45,10 +45,19 @@ export default class BookmarkModal extends Component {
@service site;
@service keyboardShortcuts;
+ /** @type {string | null | undefined} */
@tracked postDetectedLocalDate = null;
+
+ /** @type {string | null | undefined} */
@tracked postDetectedLocalTime = null;
+
+ /** @type {string | null | undefined} */
@tracked postDetectedLocalTimezone = null;
+
+ /** @type {string | import("moment").Moment | null} */
@tracked prefilledDatetime = null;
+
+ /** @type {string | null} */
@tracked flash = null;
@tracked _closeWithoutSaving = false;
diff --git a/frontend/discourse/app/components/modal/bulk-topic-actions.gjs b/frontend/discourse/app/components/modal/bulk-topic-actions.gjs
index adc37502b99..062cdf244a5 100644
--- a/frontend/discourse/app/components/modal/bulk-topic-actions.gjs
+++ b/frontend/discourse/app/components/modal/bulk-topic-actions.gjs
@@ -32,17 +32,25 @@ export function addBulkDropdownAction(name, customAction) {
export default class BulkTopicActions extends Component {
@service toasts;
+ /** @type {import("@glint/template").ComponentLike | null} */
@tracked activeComponent = null;
+
+ /** @type {Record<string, unknown> | null} */
@tracked activeComponentProps = null;
@tracked categoryId;
@tracked loading;
@tracked errors;
@tracked notifyUsers = false;
+
+ /** @type {string | null} */
@tracked closeNote = null;
+
+ /** @type {{ message: string, count: number, trustHtml?: boolean }[] | null} */
@tracked failureMessages = null;
@tracked successTopicCount = 0;
@tracked skippedTopicCount = 0;
+ /** @type {string | null | undefined} */
@tracked notificationLevelId = null;
@tracked customSubmitDisabled = false;
diff --git a/frontend/discourse/app/components/modal/bulk-topic-actions/manage-tags-form.gjs b/frontend/discourse/app/components/modal/bulk-topic-actions/manage-tags-form.gjs
index 10bf4d00469..b1ce17cbf1c 100644
--- a/frontend/discourse/app/components/modal/bulk-topic-actions/manage-tags-form.gjs
+++ b/frontend/discourse/app/components/modal/bulk-topic-actions/manage-tags-form.gjs
@@ -8,9 +8,11 @@ import { not } from "discourse/truth-helpers";
import dIcon from "discourse/ui-kit/helpers/d-icon";
import { i18n } from "discourse-i18n";
+/** @typedef {{ id: number | string, name: string, isNew?: boolean }} BulkTagChoice */
export default class ManageTagsForm extends Component {
formApi;
+ /** @type {{ remove_all_tags: boolean, remove_tags: BulkTagChoice[], add_tags: BulkTagChoice[], replace_rows: { from: BulkTagChoice[], to: BulkTagChoice[] }[] }} */
initialData = {
remove_all_tags: false,
remove_tags: [],
diff --git a/frontend/discourse/app/components/modal/change-owner.gjs b/frontend/discourse/app/components/modal/change-owner.gjs
index 37e7fbb3b5d..b351ff8d56d 100644
--- a/frontend/discourse/app/components/modal/change-owner.gjs
+++ b/frontend/discourse/app/components/modal/change-owner.gjs
@@ -14,6 +14,8 @@ import { i18n } from "discourse-i18n";
export default class ChangeOwnerModal extends Component {
@tracked saving = false;
+
+ /** @type {string | null | undefined} */
@tracked newOwner = null;
@tracked flash;
diff --git a/frontend/discourse/app/components/modal/change-reply-to.gjs b/frontend/discourse/app/components/modal/change-reply-to.gjs
index 713129b2950..7cbba876036 100644
--- a/frontend/discourse/app/components/modal/change-reply-to.gjs
+++ b/frontend/discourse/app/components/modal/change-reply-to.gjs
@@ -9,7 +9,10 @@ import DModal from "discourse/ui-kit/d-modal";
import { i18n } from "discourse-i18n";
export default class ChangeReplyTo extends Component {
+ /** @type {import("discourse/models/post").default | null} */
@tracked selectedPost = null;
+
+ /** @type {string | null} */
@tracked flash = null;
noop = () => {};
diff --git a/frontend/discourse/app/components/modal/edit-user-directory-columns-reorderable.gjs b/frontend/discourse/app/components/modal/edit-user-directory-columns-reorderable.gjs
index dfd4987b5cc..87eaedc299b 100644
--- a/frontend/discourse/app/components/modal/edit-user-directory-columns-reorderable.gjs
+++ b/frontend/discourse/app/components/modal/edit-user-directory-columns-reorderable.gjs
@@ -31,7 +31,7 @@ export default class EditUserDirectoryColumns extends Component {
* announcements — the rendered header title can carry icon markup, which an
* accessible name cannot.
*
- * @param {Object} column - The column to name.
+ * @param {{ name: string, type: string, user_field?: { name: string } | null }} column - The column to name.
* @returns {string} The translated column name.
*/
columnLabel = (column) => {
@@ -111,7 +111,7 @@ export default class EditUserDirectoryColumns extends Component {
* Applies a committed move and renumbers every column from its new visible
* slot — the stored order is exactly the displayed one here.
*
- * @param {Object} move - The normalized move from the list.
+ * @param {import("discourse/ui-kit/d-reorderable-list/types").ReorderableMove<{ id: number, name: string, type: string, position: number, enabled: boolean, icon: string | null, user_field_id: number | null, automatic_position: number | null, user_field?: { name: string, position: number } | null }>} move - The normalized move from the list.
*/
@action
handleMove(move) {
diff --git a/frontend/discourse/app/components/modal/explain-reviewable.gjs b/frontend/discourse/app/components/modal/explain-reviewable.gjs
index 19962adc406..04c67f7f56b 100644
--- a/frontend/discourse/app/components/modal/explain-reviewable.gjs
+++ b/frontend/discourse/app/components/modal/explain-reviewable.gjs
@@ -9,10 +9,15 @@ import DConditionalLoadingSpinner from "discourse/ui-kit/d-conditional-loading-s
import DModal from "discourse/ui-kit/d-modal";
import { i18n } from "discourse-i18n";
+/**
+ * @typedef {import("discourse/models/rest").default & { id: number, total_score: number, min_score_visibility: number, hide_post_score: number, scores: { user_id: number, type_bonus: number, trust_level_bonus: number | string, take_action_bonus: number, flags_agreed: number, flags_disagreed: number, flags_ignored: number, user_accuracy_bonus: number, score: number }[] }} ReviewableExplanation
+ */
export default class ExplainReviewable extends Component {
@service store;
@tracked loading = true;
+
+ /** @type {ReviewableExplanation | null} */
@tracked reviewableExplanation = null;
constructor() {
diff --git a/frontend/discourse/app/components/modal/feature-topic-on-profile.gjs b/frontend/discourse/app/components/modal/feature-topic-on-profile.gjs
index c2b53a6a2a7..de247572438 100644
--- a/frontend/discourse/app/components/modal/feature-topic-on-profile.gjs
+++ b/frontend/discourse/app/components/modal/feature-topic-on-profile.gjs
@@ -9,6 +9,7 @@ import DModal from "discourse/ui-kit/d-modal";
import { i18n } from "discourse-i18n";
export default class FeatureTopicOnProfile extends Component {
+ /** @type {import("discourse/models/topic").default | null} */
@tracked newFeaturedTopic = null;
@tracked saving = false;
diff --git a/frontend/discourse/app/components/modal/feature-topic/bulk-pin-options.gjs b/frontend/discourse/app/components/modal/feature-topic/bulk-pin-options.gjs
index dd9df83a9f8..238bca3388b 100644
--- a/frontend/discourse/app/components/modal/feature-topic/bulk-pin-options.gjs
+++ b/frontend/discourse/app/components/modal/feature-topic/bulk-pin-options.gjs
@@ -15,7 +15,11 @@ export default class BulkPinOptions extends Component {
@tracked loading = true;
@tracked pinnedInCategoryCount = 0;
@tracked pinnedGloballyCount = 0;
+
+ /** @type {string | null} */
@tracked pinnedInCategoryUntil = null;
+
+ /** @type {string | null} */
@tracked pinnedGloballyUntil = null;
constructor() {
diff --git a/frontend/discourse/app/components/modal/grant-badge.gjs b/frontend/discourse/app/components/modal/grant-badge.gjs
index 993b3f43b56..790b0084047 100644
--- a/frontend/discourse/app/components/modal/grant-badge.gjs
+++ b/frontend/discourse/app/components/modal/grant-badge.gjs
@@ -22,8 +22,14 @@ import { i18n } from "discourse-i18n";
export default class GrantBadgeModal extends Component {
@tracked loading = true;
@tracked saving = false;
+
+ /** @type {number | null} */
@tracked selectedBadgeId = null;
+
+ /** @type {string | null} */
@tracked flash = null;
+
+ /** @type {"success" | "error" | null} */
@tracked flashType = null;
@tracked allBadges = [];
@tracked availableBadges = [];
diff --git a/frontend/discourse/app/components/modal/ignore-duration-with-username.gjs b/frontend/discourse/app/components/modal/ignore-duration-with-username.gjs
index 3b834e87592..21ea978bc14 100644
--- a/frontend/discourse/app/components/modal/ignore-duration-with-username.gjs
+++ b/frontend/discourse/app/components/modal/ignore-duration-with-username.gjs
@@ -21,6 +21,8 @@ export default class IgnoreDurationModal extends Component {
@tracked flash;
@tracked loading = false;
+
+ /** @type {string | null} */
@tracked ignoredUntil = null;
@tracked ignoredUsername = this.args.model.ignoredUsername;
diff --git a/frontend/discourse/app/components/modal/json-schema-editor.gjs b/frontend/discourse/app/components/modal/json-schema-editor.gjs
index c7797393861..2b968a96655 100644
--- a/frontend/discourse/app/components/modal/json-schema-editor.gjs
+++ b/frontend/discourse/app/components/modal/json-schema-editor.gjs
@@ -11,6 +11,7 @@ import DModal from "discourse/ui-kit/d-modal";
import { i18n } from "discourse-i18n";
export default class JsonSchemaEditorModal extends Component {
+ /** @type {{ destroy: () => void, validate: () => { message: string }[], getValue: () => unknown } | null} */
@tracked editor = null;
@tracked value = this.args.model.value;
@tracked flash;
diff --git a/frontend/discourse/app/components/modal/post-translations.gjs b/frontend/discourse/app/components/modal/post-translations.gjs
index 1c7415cb522..cf72c58904d 100644
--- a/frontend/discourse/app/components/modal/post-translations.gjs
+++ b/frontend/discourse/app/components/modal/post-translations.gjs
@@ -17,6 +17,9 @@ import DModal from "discourse/ui-kit/d-modal";
import dConcatClass from "discourse/ui-kit/helpers/d-concat-class";
import { i18n } from "discourse-i18n";
+/**
+ * @typedef {{ id: number, post_id: number, post_version: number, locale: string, raw: string, languageName: string, topic_localization?: { id: number, topic_id: number, locale: string, title: string, fancy_title: string } }} PostLocalizationWithLanguage
+ */
export default class PostTranslationsModal extends Component {
@service composer;
@service dialog;
@@ -24,6 +27,7 @@ export default class PostTranslationsModal extends Component {
@service siteSettings;
@service toasts;
+ /** @type {PostLocalizationWithLanguage[] | null} */
@tracked postLocalizations = null;
@tracked loading = false;
@tracked savingPostLocale = false;
diff --git a/frontend/discourse/app/components/modal/publish-page.gjs b/frontend/discourse/app/components/modal/publish-page.gjs
index cae1ebe19fc..49ee1c29429 100644
--- a/frontend/discourse/app/components/modal/publish-page.gjs
+++ b/frontend/discourse/app/components/modal/publish-page.gjs
@@ -28,7 +28,11 @@ export default class PublishPageModal extends Component {
@service store;
@tracked state = States.initializing;
+
+ /** @type {string | null | undefined} */
@tracked reason = null;
+
+ /** @type {import("discourse/models/published-page").default | null} */
@tracked publishedPage = null;
constructor() {
diff --git a/frontend/discourse/app/components/modal/reorder-categories.gjs b/frontend/discourse/app/components/modal/reorder-categories.gjs
index b568f2a9f89..53e7b818127 100644
--- a/frontend/discourse/app/components/modal/reorder-categories.gjs
+++ b/frontend/discourse/app/components/modal/reorder-categories.gjs
@@ -30,6 +30,8 @@ export default class ReorderCategories extends Component {
@tracked changed = false;
@tracked entries = this.reorder();
+
+ /** @type {number | null} */
@tracked highlightedCategoryId = null;
get sortedEntries() {
diff --git a/frontend/discourse/app/components/modal/second-factor-add-security-key.gjs b/frontend/discourse/app/components/modal/second-factor-add-security-key.gjs
index c78b8320634..535ea06ea00 100644
--- a/frontend/discourse/app/components/modal/second-factor-add-security-key.gjs
+++ b/frontend/discourse/app/components/modal/second-factor-add-security-key.gjs
@@ -20,6 +20,8 @@ export default class SecondFactorAddSecurityKey extends Component {
@service capabilities;
@tracked loading = false;
+
+ /** @type {string | null} */
@tracked errorMessage = null;
@tracked securityKeyName;
diff --git a/frontend/discourse/app/components/modal/spreadsheet-editor.gjs b/frontend/discourse/app/components/modal/spreadsheet-editor.gjs
index 0f5333affa2..64c713af713 100644
--- a/frontend/discourse/app/components/modal/spreadsheet-editor.gjs
+++ b/frontend/discourse/app/components/modal/spreadsheet-editor.gjs
@@ -25,10 +25,16 @@ export default class SpreadsheetEditor extends Component {
@tracked showEditReason = false;
@tracked loading = true;
+
+ /** @type {HTMLElement | import("jspreadsheet-ce").WorksheetInstance | null} */
spreadsheet = null;
defaultColWidth = 150;
isEditingTable = !!this.args.model.tableTokens;
+
+ /** @type {("left" | "center" | "right" | null)[] | null} */
alignments = null;
+
+ /** @type {string | null} */
initialSnapshot = null;
constructor() {
diff --git a/frontend/discourse/app/components/navigation-item.gjs b/frontend/discourse/app/components/navigation-item.gjs
index 75468696c48..c8ed972ddc6 100644
--- a/frontend/discourse/app/components/navigation-item.gjs
+++ b/frontend/discourse/app/components/navigation-item.gjs
@@ -11,6 +11,8 @@ export default class NavigationItem extends Component {
filterMode;
hidden = false;
activeClass = "";
+
+ /** @type {string | null | undefined} */
hrefLink = null;
@dependentKeyCompat
diff --git a/frontend/discourse/app/components/nested.gjs b/frontend/discourse/app/components/nested.gjs
index 44e253aa3b2..80a61c61532 100644
--- a/frontend/discourse/app/components/nested.gjs
+++ b/frontend/discourse/app/components/nested.gjs
@@ -42,6 +42,9 @@ const STORED_SCROLL_ANCHORS = Object.create(null);
// Exported so system specs can wait out the full restoration window.
export const SCROLL_RESTORE_WINDOW_MS = 1250;
+/**
+ * @typedef {{ post: import("discourse/models/post").default, children: NestedPostNode[], _renderKey?: number | string }} NestedPostNode
+ */
export default class Nested extends Component {
@service appEvents;
@service currentUser;
@@ -55,6 +58,8 @@ export default class Nested extends Component {
@tracked cloakBelow = 0;
@tracked focusDirection = "forward";
@tracked focusedPath = [];
+
+ /** @type {{ postNumber: number, offsetFromTop: number, scrollY?: number } | null} */
@tracked mobileReturnAnchor = null;
viewportTracker = new PostStreamViewportTracker();
#initialFocusedPathKey = null;
@@ -166,6 +171,7 @@ export default class Nested extends Component {
this.viewportTracker.destroy();
}
+ /** @returns {NestedPostNode[]} */
get emptyPath() {
return [];
}
diff --git a/frontend/discourse/app/components/nested/post-children.gjs b/frontend/discourse/app/components/nested/post-children.gjs
index c852f12b94f..094aa744e0c 100644
--- a/frontend/discourse/app/components/nested/post-children.gjs
+++ b/frontend/discourse/app/components/nested/post-children.gjs
@@ -26,7 +26,11 @@ export default class NestedPostChildren extends Component {
// Tracks whether we've fetched from the server yet (vs only having preloaded data)
_fetchedFromServer = false;
+
+ /** @type {string | null} */
_identityKey = null;
+
+ /** @type {string | null} */
_activeCacheKey = null;
constructor() {
diff --git a/frontend/discourse/app/components/plugin-outlet.gjs b/frontend/discourse/app/components/plugin-outlet.gjs
index dca097a509f..a0b0b7b4f91 100644
--- a/frontend/discourse/app/components/plugin-outlet.gjs
+++ b/frontend/discourse/app/components/plugin-outlet.gjs
@@ -31,8 +31,8 @@ const VALID_POSITIONS = ["before", "after"];
* Normalizes an alias entry to a consistent object form.
* Accepts either a plain string or an object with a `name` property.
*
- * @param {string|Object} alias - The alias entry to normalize.
- * @returns {{ name: string, deprecated?: boolean, position?: string, since?: string, message?: string, id?: string, url?: string, raiseError?: boolean }}
+ * @param {string | PluginOutletAlias} alias - The alias entry to normalize.
+ * @returns {PluginOutletAlias}
*/
export function normalizeAlias(alias) {
if (typeof alias === "string") {
@@ -372,7 +372,7 @@ export default class PluginOutlet extends Component {
* Normalized alias entries from @aliases arg.
* Each entry is an object with at least a `name` property.
*
- * @returns {Array<{ name: string, deprecated?: boolean, since?: string, message?: string, id?: string, url?: string, raiseError?: boolean }>}
+ * @returns {PluginOutletAlias[]}
*/
@cached
get normalizedAliases() {
@@ -388,7 +388,7 @@ export default class PluginOutlet extends Component {
* standalone outlets into a wrapper's before slot), plus `__before` variants
* of all aliases without a position (for inheriting wrapper sub-outlet connectors).
*
- * @returns {Array<Object>}
+ * @returns {PluginOutletAlias[]}
*/
@cached
get aliasesForBefore() {
@@ -413,7 +413,7 @@ export default class PluginOutlet extends Component {
* standalone outlets into a wrapper's after slot), plus `__after` variants
* of all aliases without a position (for inheriting wrapper sub-outlet connectors).
*
- * @returns {Array<Object>}
+ * @returns {PluginOutletAlias[]}
*/
@cached
get aliasesForAfter() {
diff --git a/frontend/discourse/app/components/pwa-install-banner.gjs b/frontend/discourse/app/components/pwa-install-banner.gjs
index 6473d98af46..916139e8392 100644
--- a/frontend/discourse/app/components/pwa-install-banner.gjs
+++ b/frontend/discourse/app/components/pwa-install-banner.gjs
@@ -19,6 +19,7 @@ export default class PwaInstallBanner extends Component {
bannerDismissed =
this.keyValueStore.get(USER_DISMISSED_PROMPT_KEY) === "true";
+ /** @type {(Event & { prompt: () => unknown }) | null} */
@tracked deferredInstallPromptEvent = null;
registerInstallPromptListener = modifierFn(() => {
diff --git a/frontend/discourse/app/components/reviewable/insights.gjs b/frontend/discourse/app/components/reviewable/insights.gjs
index 002923fa721..3eddafadc8e 100644
--- a/frontend/discourse/app/components/reviewable/insights.gjs
+++ b/frontend/discourse/app/components/reviewable/insights.gjs
@@ -17,7 +17,7 @@ import { i18n } from "discourse-i18n";
export default class ReviewableInsights extends Component {
/**
* Returns array of review insight objects to display
- * @returns {Array<Object>} Array of insight configuration objects
+ * @returns {{ icon?: string, label: string, description: string | import("@ember/template").TrustedHTML }[]} Array of insight configuration objects
*/
get reviewInsights() {
const insights = [];
diff --git a/frontend/discourse/app/components/reviewable/item.gjs b/frontend/discourse/app/components/reviewable/item.gjs
index c463e44d085..9a9308f1f4e 100644
--- a/frontend/discourse/app/components/reviewable/item.gjs
+++ b/frontend/discourse/app/components/reviewable/item.gjs
@@ -128,6 +128,7 @@ export default class ReviewableItem extends Component {
this.messageBus.unsubscribe("/reviewable_action", this._updateStatus);
}
+ /** @returns {{ activeTab: string, insightsOpened: boolean, updates: Record<string, unknown> | null }} */
@cached
get state() {
// reading the argument is what ties this cache to a single reviewable
diff --git a/frontend/discourse/app/components/reviewable/note-form.gjs b/frontend/discourse/app/components/reviewable/note-form.gjs
index 69f2cb33852..5f9e5026849 100644
--- a/frontend/discourse/app/components/reviewable/note-form.gjs
+++ b/frontend/discourse/app/components/reviewable/note-form.gjs
@@ -18,6 +18,9 @@ import userSearch, { validateSearchResult } from "discourse/lib/user-search";
import dAutocomplete from "discourse/ui-kit/modifiers/d-autocomplete";
import { i18n } from "discourse-i18n";
+/**
+ * @typedef {{ get: (name: string) => unknown, set: (name: string, value: unknown) => Promise<void> }} ReviewableNoteFormApi
+ */
/**
* A form component for adding notes to Reviewable items.
*
@@ -62,7 +65,7 @@ export default class ReviewableNoteForm extends Component {
/**
* Registers the Form API reference.
*
- * @param {Object} api - The Form API object, with form helper methods.
+ * @param {ReviewableNoteFormApi} api - The Form API object, with form helper methods.
*/
@action
registerApi(api) {
@@ -77,7 +80,7 @@ export default class ReviewableNoteForm extends Component {
/**
* Handles form submission from Form component.
*
- * @param {Object} data - Form data from Form component
+ * @param {{ content?: string }} data - Form data from Form component
*/
@action
async onSubmit(data) {
diff --git a/frontend/discourse/app/components/reviewable/timeline.gjs b/frontend/discourse/app/components/reviewable/timeline.gjs
index fe04a28961b..326fcc1d99a 100644
--- a/frontend/discourse/app/components/reviewable/timeline.gjs
+++ b/frontend/discourse/app/components/reviewable/timeline.gjs
@@ -24,6 +24,11 @@ import dFormatDate from "discourse/ui-kit/helpers/d-format-date";
import dIcon from "discourse/ui-kit/helpers/d-icon";
import { i18n } from "discourse-i18n";
+/**
+ * @typedef {{ id: number, username: string, avatar_template: string, name?: string | null }} ReviewableTimelineUser
+ * @typedef {{ id: number, content: string, cooked?: string | null, created_at: string, updated_at: string, user?: ReviewableTimelineUser | null }} ReviewableNoteData
+ * @typedef {{ type: string, date: string, user: ReviewableTimelineUser | null | undefined, icon: string, titleKey?: string, description?: import("@ember/template").TrustedHTML | null, score?: { count: number, type: string, title: string }, noteId?: number, canDelete?: boolean | null }} ReviewableTimelineEvent
+ */
/**
* Timeline component for reviewable items that displays chronological events
* including flags, reviews, notes, and target post creation.
@@ -37,7 +42,7 @@ export default class ReviewableTimeline extends Component {
* Combines all timeline events from reviewable scores, histories, and the reviewable itself
* and sorts them chronologically.
*
- * @returns {Array<Object>} Array of timeline event objects sorted by date (newest first)
+ * @returns {ReviewableTimelineEvent[]} Array of timeline event objects sorted by date (newest first)
*/
get timelineEvents() {
const events = [];
@@ -209,7 +214,7 @@ export default class ReviewableTimeline extends Component {
/**
* Handles creation of a new note.
*
- * @param {Object} noteData - The created note data from the server
+ * @param {ReviewableNoteData} noteData - The created note data from the server
*/
@action
onNoteCreated(noteData) {
diff --git a/frontend/discourse/app/components/search-bulk-select-dropdown.gjs b/frontend/discourse/app/components/search-bulk-select-dropdown.gjs
index 49e624c6c0f..156b1237839 100644
--- a/frontend/discourse/app/components/search-bulk-select-dropdown.gjs
+++ b/frontend/discourse/app/components/search-bulk-select-dropdown.gjs
@@ -12,6 +12,7 @@ import { i18n } from "discourse-i18n";
export default class SearchBulkSelectDropdown extends Component {
@service dialog;
+ /** @type {import("discourse/lib/bulk-select-helper").default | null} */
_bulkSelectHelper = null;
get topics() {
@@ -24,6 +25,7 @@ export default class SearchBulkSelectDropdown extends Component {
return Array.from(topics.values());
}
+ /** @returns {BulkSelectHelper} */
get topicBulkSelectHelper() {
if (!this._bulkSelectHelper) {
this._bulkSelectHelper = new BulkSelectHelper(this, this.topics);
diff --git a/frontend/discourse/app/components/search-menu.gjs b/frontend/discourse/app/components/search-menu.gjs
index 204711dfb02..59ff91c4e3e 100644
--- a/frontend/discourse/app/components/search-menu.gjs
+++ b/frontend/discourse/app/components/search-menu.gjs
@@ -59,7 +59,11 @@ export default class SearchMenu extends Component {
searchInputId = this.args.searchInputId ?? "search-term";
closeWhenHidden = modifier((_element, [hidden]) => hidden && this.close());
+
+ /** @type {import("@ember/runloop").Timer | null} */
_debouncer = null;
+
+ /** @type {(Promise<unknown> & { abort: () => void }) | null} */
_activeSearch = null;
willDestroy() {
diff --git a/frontend/discourse/app/components/search-menu/search-term.gjs b/frontend/discourse/app/components/search-menu/search-term.gjs
index 0957f930e74..914ae56ec54 100644
--- a/frontend/discourse/app/components/search-menu/search-term.gjs
+++ b/frontend/discourse/app/components/search-menu/search-term.gjs
@@ -22,6 +22,7 @@ export default class SearchTerm extends Component {
@service search;
@service capabilities;
+ /** @type {number | null} */
@tracked lastEnterTimestamp = null;
@tracked searchCleared = !this.search.activeGlobalSearchTerm;
diff --git a/frontend/discourse/app/components/setting-field/compact-list.gjs b/frontend/discourse/app/components/setting-field/compact-list.gjs
index 0e2f99f434f..9c1b61db3d3 100644
--- a/frontend/discourse/app/components/setting-field/compact-list.gjs
+++ b/frontend/discourse/app/components/setting-field/compact-list.gjs
@@ -9,6 +9,7 @@ import ListSetting from "discourse/select-kit/components/list-setting";
const TOKEN_SEPARATOR = "|";
export default class SettingFieldCompactList extends Component {
+ /** @type {Array<string | { name: string, value: string }> | null} */
@tracked createdChoices = null;
get hasEnumChoices() {
diff --git a/frontend/discourse/app/components/sidebar/common/categories-section.gjs b/frontend/discourse/app/components/sidebar/common/categories-section.gjs
index b1e0731b619..a1617cfe050 100644
--- a/frontend/discourse/app/components/sidebar/common/categories-section.gjs
+++ b/frontend/discourse/app/components/sidebar/common/categories-section.gjs
@@ -17,7 +17,7 @@ export default class SidebarCommonCategoriesSection extends Component {
/**
* Override in child
*
- * @returns {Object[]} An array of Category objects
+ * @returns {Category[] | undefined} An array of Category objects
*/
get categories() {}
diff --git a/frontend/discourse/app/components/sidebar/section-form-links-reorderable.gjs b/frontend/discourse/app/components/sidebar/section-form-links-reorderable.gjs
index 8db5a630301..e9a0dfd3365 100644
--- a/frontend/discourse/app/components/sidebar/section-form-links-reorderable.gjs
+++ b/frontend/discourse/app/components/sidebar/section-form-links-reorderable.gjs
@@ -26,7 +26,7 @@ export default class SidebarSectionFormLinksReorderable extends Component {
* Applies a committed move onto the backing arrays, which hold links awaiting
* deletion as well as visible ones.
*
- * @param {Object} move - The normalized move from the list.
+ * @param {import("discourse/ui-kit/d-reorderable-list/types").ReorderableMove<{ segment: string }>} move - The normalized move from the list.
*/
@bind
handleMove(move) {
diff --git a/frontend/discourse/app/components/tag-settings.gjs b/frontend/discourse/app/components/tag-settings.gjs
index b0bcd1228bf..d0113dd17a2 100644
--- a/frontend/discourse/app/components/tag-settings.gjs
+++ b/frontend/discourse/app/components/tag-settings.gjs
@@ -20,6 +20,11 @@ import DPageHeader from "discourse/ui-kit/d-page-header";
import { categoryBadgeHTML } from "discourse/ui-kit/helpers/d-category-link";
import { i18n } from "discourse-i18n";
+/**
+ * @typedef {{ id: number | string, name: string, isNew?: boolean }} TagSynonymChoice
+ * @typedef {{ id?: number, tag_id: number, locale: string, name: string, description: string | null, description_cooked?: string | null }} TagSettingsLocalization
+ * @typedef {{ name: string, locale: string | null | undefined, slug: string, description: string, synonyms: TagSynonymChoice[], new_synonyms: TagSynonymChoice[], removed_synonym_ids: number[], localizations: TagSettingsLocalization[] }} TagSettingsFormData
+ */
export default class TagSettings extends Component {
@service router;
@service dialog;
@@ -28,6 +33,7 @@ export default class TagSettings extends Component {
@service store;
@service appEvents;
+ /** @type {{ get: (name: string) => unknown, set: (name: string, value: unknown) => Promise<void> } | null} */
@tracked form = null;
@tracked tags = [];
@@ -40,6 +46,7 @@ export default class TagSettings extends Component {
return this.tags.map((t) => t.name);
}
+ /** @returns {TagSettingsFormData} */
get formData() {
return {
name: this.args.tag.name,
diff --git a/frontend/discourse/app/components/topic-admin-menu.gjs b/frontend/discourse/app/components/topic-admin-menu.gjs
index c5a0b0fa1ef..d3d31e732a3 100644
--- a/frontend/discourse/app/components/topic-admin-menu.gjs
+++ b/frontend/discourse/app/components/topic-admin-menu.gjs
@@ -14,6 +14,9 @@ import dConcatClass from "discourse/ui-kit/helpers/d-concat-class";
import dIcon from "discourse/ui-kit/helpers/d-icon";
import { i18n } from "discourse-i18n";
+/**
+ * @typedef {{ action?: () => unknown, icon?: string, className?: string, label?: string, translatedLabel?: string, section?: { id: string, label?: string, translatedLabel?: string } }} TopicAdminButton
+ */
export default class TopicAdminMenu extends Component {
@service adminTopicMenuButtons;
@service currentUser;
@@ -27,6 +30,7 @@ export default class TopicAdminMenu extends Component {
.filter(Boolean);
}
+ /** @returns {{ id: string | null, label: string | null, buttons: TopicAdminButton[] }[]} */
get extraButtonGroups() {
const groups = [];
let currentGroup = null;
diff --git a/frontend/discourse/app/components/topic-map/topic-views-chart.gjs b/frontend/discourse/app/components/topic-map/topic-views-chart.gjs
index 4c0b810363d..1f3105c3ec4 100644
--- a/frontend/discourse/app/components/topic-map/topic-views-chart.gjs
+++ b/frontend/discourse/app/components/topic-map/topic-views-chart.gjs
@@ -73,6 +73,8 @@ function predictTodaysViews(data) {
export default class TopicViewsChart extends Component {
@tracked noData = false;
+
+ /** @type {import("chart.js").Chart<"line"> | null} */
chart = null;
@action
diff --git a/frontend/discourse/app/components/topic-navigation.gjs b/frontend/discourse/app/components/topic-navigation.gjs
index 5a2ddafe3e9..97526128293 100644
--- a/frontend/discourse/app/components/topic-navigation.gjs
+++ b/frontend/discourse/app/components/topic-navigation.gjs
@@ -26,6 +26,8 @@ const MIN_HEIGHT_TIMELINE = 325;
// component, so tracking is preserved without coupling.
class TopicNavigationInfo {
@tracked topicProgressExpanded = false;
+
+ /** @type {{ postIndex: number | null, percent: number } | null} */
@tracked prevEvent = null;
#postCountFetcher;
@@ -58,6 +60,8 @@ export default class TopicNavigation extends Component {
() => this.renderTimeline
);
widthQuery = this.setupWidthQuery();
+
+ /** @type {HTMLElement | null} */
movingElement = null;
pxClosed = 0;
setupSwipe = modifierFn((element) => {
@@ -123,6 +127,7 @@ export default class TopicNavigation extends Component {
return true;
}
+ /** @returns {TrackedMediaQuery | null} */
@cached
get heightQuery() {
const threshold = this.composer.isPreviewActive
diff --git a/frontend/discourse/app/components/topic-progress.gjs b/frontend/discourse/app/components/topic-progress.gjs
index efbb1a45982..df8fb2cf9b3 100644
--- a/frontend/discourse/app/components/topic-progress.gjs
+++ b/frontend/discourse/app/components/topic-progress.gjs
@@ -12,8 +12,11 @@ import { i18n } from "discourse-i18n";
export default class TopicProgress extends Component {
elementId = "topic-progress-wrapper";
docked = false;
+
+ /** @type {number | null} */
progressPosition = null;
+ /** @type {number | string | null} */
_streamPercentage = null;
@computed("topic.postStream")
diff --git a/frontend/discourse/app/components/topic-timeline/container.gjs b/frontend/discourse/app/components/topic-timeline/container.gjs
index 829cef267ff..71413dc2f6d 100644
--- a/frontend/discourse/app/components/topic-timeline/container.gjs
+++ b/frontend/discourse/app/components/topic-timeline/container.gjs
@@ -69,6 +69,8 @@ export default class TopicTimelineScrollArea extends Component {
);
@tracked total;
@tracked date;
+
+ /** @type {number | null} */
@tracked lastReadPercentage = null;
@tracked lastRead;
@tracked lastReadTop;
@@ -78,9 +80,16 @@ export default class TopicTimelineScrollArea extends Component {
@tracked dragging = false;
@tracked excerpt = "";
+ /** @type {IntersectionObserver | null} */
intersectionObserver = null;
+
+ /** @type {HTMLElement | null} */
scrollareaElement = null;
+
+ /** @type {HTMLElement | null} */
scrollerElement = null;
+
+ /** @type {number | null} */
dragOffset = null;
constructor() {
diff --git a/frontend/discourse/app/components/topic-timer-info.gjs b/frontend/discourse/app/components/topic-timer-info.gjs
index 0a1357ea312..32dac06eab9 100644
--- a/frontend/discourse/app/components/topic-timer-info.gjs
+++ b/frontend/discourse/app/components/topic-timer-info.gjs
@@ -18,11 +18,22 @@ export default class TopicTimerInfo extends Component {
clockIcon = trustHTML(`${iconHTML("far-clock")}`);
trashLabel = i18n("post.controls.remove_timer");
+ /** @type {import("@ember/template").TrustedHTML | null} */
title = null;
+
+ /** @type {import("@ember/template").TrustedHTML | null} */
notice = null;
+
+ /** @type {boolean | null} */
showTopicTimer = null;
+
+ /** @type {(() => void) | null | undefined} */
showTopicTimerModal = null;
+
+ /** @type {(() => void) | null | undefined} */
removeTopicTimer = null;
+
+ /** @type {import("@ember/runloop").Timer | null} */
_delayedRerender = null;
@computed("currentUser.canSetTopicTimer")
diff --git a/frontend/discourse/app/components/user-card-contents.gjs b/frontend/discourse/app/components/user-card-contents.gjs
index ae5364bfcc1..2aff7ee83f0 100644
--- a/frontend/discourse/app/components/user-card-contents.gjs
+++ b/frontend/discourse/app/components/user-card-contents.gjs
@@ -58,9 +58,11 @@ export default class UserCardContents extends CardContentsBase {
mentionSelector = "a.mention";
ariaLabel = i18n("user.card");
+ /** @type {import("discourse/models/user").default | null} */
user = null;
// If inside a topic
+ /** @type {number | null | undefined} */
topicPostCount = null;
@computed("topic.postStream")
diff --git a/frontend/discourse/app/components/user-menu/notifications-list.js b/frontend/discourse/app/components/user-menu/notifications-list.js
index 8850d8b6f89..173b2b0b09b 100644
--- a/frontend/discourse/app/components/user-menu/notifications-list.js
+++ b/frontend/discourse/app/components/user-menu/notifications-list.js
@@ -63,6 +63,7 @@ export default class UserMenuNotificationsList extends UserMenuItemsList {
return this.args.filterByTypes;
}
+ /** @returns {string[] | null | undefined} */
get dismissTypes() {
return null;
}
diff --git a/frontend/discourse/app/components/user-notification-schedule.gjs b/frontend/discourse/app/components/user-notification-schedule.gjs
index 5b4ecbc6caa..4d2d8cee560 100644
--- a/frontend/discourse/app/components/user-notification-schedule.gjs
+++ b/frontend/discourse/app/components/user-notification-schedule.gjs
@@ -17,8 +17,13 @@ const DAYS = [
];
class Day extends EmberObject {
+ /** @type {number | null} */
id = null;
+
+ /** @type {Array<{ name: string, value: number }> | null} */
startTimeOptions = null;
+
+ /** @type {import("discourse/models/user").default | null} */
model = null;
@computed("model.user_notification_schedule.day_{0,1,2,3,4,5,6}_start_time")
@@ -76,6 +81,7 @@ class Day extends EmberObject {
@tagName("")
export default class UserNotificationSchedule extends Component {
+ /** @type {Day[] | null} */
days = null;
didInsertElement() {
diff --git a/frontend/discourse/app/components/user/users-popup.gjs b/frontend/discourse/app/components/user/users-popup.gjs
index 273b3b2e1cb..886c74ba177 100644
--- a/frontend/discourse/app/components/user/users-popup.gjs
+++ b/frontend/discourse/app/components/user/users-popup.gjs
@@ -34,6 +34,8 @@ export default class UsersPopup extends Component {
@tracked users = [];
@tracked loading = false;
@tracked canLoadMore = true;
+
+ /** @type {number | null} */
@tracked bodyMinHeight = null;
displayName = (user) => {
diff --git a/frontend/discourse/app/components/username-preference.gjs b/frontend/discourse/app/components/username-preference.gjs
index ec12331c1d0..f62b7ca2ea0 100644
--- a/frontend/discourse/app/components/username-preference.gjs
+++ b/frontend/discourse/app/components/username-preference.gjs
@@ -21,6 +21,8 @@ export default class UsernamePreference extends Component {
@tracked editing = false;
@tracked newUsername = this.args.user.username;
+
+ /** @type {string | null} */
@tracked errorMessage = null;
@tracked saving = false;
@tracked taken = false;