Make more code conform to strict null checks (#10219

* Make more code conform to strict null checks

* Fix types

* Fix tests

* Fix remaining test assertions

* Iterate PR
This commit is contained in:
Michael Telatynski
2023-02-24 15:28:40 +00:00
committed by GitHub
parent 4c79ecf141
commit 76b82b4b2b
130 changed files with 603 additions and 603 deletions

View File

@@ -37,7 +37,7 @@ export async function copyPlaintext(text: string): Promise<boolean> {
textArea.style.position = "fixed";
document.body.appendChild(textArea);
const selection = document.getSelection();
const selection = document.getSelection()!;
const range = document.createRange();
// range.selectNodeContents(textArea);
range.selectNode(textArea);
@@ -59,7 +59,7 @@ export function selectText(target: Element): void {
const range = document.createRange();
range.selectNodeContents(target);
const selection = window.getSelection();
const selection = window.getSelection()!;
selection.removeAllRanges();
selection.addRange(range);
}
@@ -80,5 +80,5 @@ export function copyNode(ref: Element): boolean {
* @returns the selected text
*/
export function getSelectedText(): string {
return window.getSelection().toString();
return window.getSelection()!.toString();
}