Skip to content

Commit 9e1469f

Browse files
committed
Remove unnecessary assertions
1 parent 000bc2d commit 9e1469f

File tree

24 files changed

+32
-32
lines changed

24 files changed

+32
-32
lines changed

ts/WoltLabSuite/Core/Acp/Ui/Box/Handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class AcpUiBoxHandler {
155155

156156
UiPageSearchHandler.open(
157157
this.activePageId,
158-
selectedOption.textContent!.trim(),
158+
selectedOption.textContent.trim(),
159159
(objectId) => {
160160
this.pageObjectId.value = objectId.toString();
161161
this.cache.set(this.activePageId, objectId);

ts/WoltLabSuite/Core/Acp/Ui/Maintenance/RebuildData.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ export async function runAllWorkers(): Promise<void> {
3434

3535
let i = 1;
3636
for (const worker of sorted) {
37-
await runWorker(worker, `${worker.textContent!} (${i++} / ${sorted.length})`, true);
37+
await runWorker(worker, `${worker.textContent} (${i++} / ${sorted.length})`, true);
3838
}
3939
}
4040

4141
async function runWorker(
4242
button: HTMLElement,
43-
dialogTitle: string = button.textContent!,
43+
dialogTitle: string = button.textContent,
4444
implicitContinue = false,
4545
): Promise<void> {
4646
return new Promise<void>((resolve, reject) => {

ts/WoltLabSuite/Core/Acp/Ui/Menu/Item/Handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class AcpUiMenuItemHandler {
4646

4747
UiPageSearchHandler.open(
4848
parseInt(selectedOption.value),
49-
selectedOption.textContent!.trim(),
49+
selectedOption.textContent.trim(),
5050
(objectId) => {
5151
this.#pageObjectId.value = objectId.toString();
5252
},

ts/WoltLabSuite/Core/Acp/Ui/Page/Menu/Main/Backend.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { MenuItem, PageMenuMainProvider } from "../../../../../Ui/Page/Menu/Main
1111
function getSubMenuItems(subMenu: HTMLElement, menuItem: string): MenuItem[] {
1212
const categoryList = subMenu.querySelector(`.acpPageSubMenuCategoryList[data-menu-item="${menuItem}"]`)!;
1313
return Array.from(categoryList.querySelectorAll(".acpPageSubMenuCategory")).map((category: HTMLOListElement) => {
14-
const title = category.querySelector("span")!.textContent!;
14+
const title = category.querySelector("span")!.textContent;
1515
const children = getMenuItems(category);
1616

1717
return {
@@ -41,7 +41,7 @@ function getMenuItems(category: HTMLOListElement): MenuItem[] {
4141
depth: 2,
4242
identifier: null,
4343
link: link.href,
44-
title: link.textContent!,
44+
title: link.textContent,
4545
};
4646
});
4747
}
@@ -73,7 +73,7 @@ export class AcpUiPageMenuMainBackend implements PageMenuMainProvider {
7373
const menuItems: MenuItem[] = Array.from(menu.querySelectorAll(".acpPageMenuLink")).map(
7474
(button: HTMLButtonElement) => {
7575
const menuItem = button.dataset.menuItem!;
76-
const title = button.querySelector(".acpPageMenuItemLabel")!.textContent!;
76+
const title = button.querySelector(".acpPageMenuItemLabel")!.textContent;
7777
const children = getSubMenuItems(subMenu, menuItem);
7878
let icon = button.querySelector("fa-icon") ?? undefined;
7979
if (icon) {

ts/WoltLabSuite/Core/Bbcode/Code.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class Code {
9999
}
100100

101101
const container = document.createElement("div");
102-
container.innerHTML = Prism.highlight(this.codeContainer.textContent!, grammar, this.language);
102+
container.innerHTML = Prism.highlight(this.codeContainer.textContent, grammar, this.language);
103103

104104
// Step 3) Insert the highlighted lines into the page.
105105
// This is performed in small chunks to prevent the UI thread from being blocked for complex

ts/WoltLabSuite/Core/Clipboard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ export async function copyTextToClipboard(text: string): Promise<void> {
1515
}
1616

1717
export async function copyElementTextToClipboard(element: HTMLElement): Promise<void> {
18-
return copyTextToClipboard(element.textContent!.replace(/\u200B/g, "").replace(/\u00A0/g, " "));
18+
return copyTextToClipboard(element.textContent.replace(/\u200B/g, "").replace(/\u00A0/g, " "));
1919
}

ts/WoltLabSuite/Core/Component/Dialog/Setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class DialogSetup {
4141

4242
fromHtml(html: string): DialogControls {
4343
const fragment = DomUtil.createFragmentFromHtml(html);
44-
if (fragment.childElementCount === 0 && fragment.textContent!.trim() === "") {
44+
if (fragment.childElementCount === 0 && fragment.textContent.trim() === "") {
4545
throw new TypeError("The provided HTML string was empty.");
4646
}
4747

ts/WoltLabSuite/Core/Component/GoogleMaps/MarkerLoader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class MarkerLoader {
120120
if (!dialog) {
121121
dialog = dialogFactory().fromHtml(data.dialog!).withoutControls();
122122
}
123-
dialog.show(button.dataset.title || button.textContent!);
123+
dialog.show(button.dataset.title || button.textContent);
124124
});
125125
});
126126
}

ts/WoltLabSuite/Core/Component/Quote/Message.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ function getNodeText(node: Node): string {
307307

308308
if (node instanceof HTMLAnchorElement) {
309309
// \u2026 === &hellip;
310-
const value = node.textContent!;
310+
const value = node.textContent;
311311
if (value.indexOf("\u2026") > 0) {
312312
const tmp = value.split(/\u2026/);
313313
if (tmp.length === 2) {

ts/WoltLabSuite/Core/Date/Picker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ function renderGrid(day?: number, month?: number, year?: number): void {
552552
for (let i = 0; i < 37; i++) {
553553
const cell = _dateCells[i];
554554

555-
let active = +cell.textContent! === day;
555+
let active = +cell.textContent === day;
556556
if (cell.classList.contains("otherMonth") || cell.classList.contains("disabled")) {
557557
active = false;
558558
}
@@ -625,7 +625,7 @@ function click(event: MouseEvent): void {
625625

626626
_input!.dataset.empty = "false";
627627

628-
renderGrid(+target.textContent!);
628+
renderGrid(+target.textContent);
629629

630630
const data = _data.get(_input!) as DatePickerData;
631631
if (!data.isDateTime) {

0 commit comments

Comments
 (0)