From 2581d9b7467818a7d453246d5580ce68fcfac83b Mon Sep 17 00:00:00 2001 From: Jack Case Date: Mon, 27 Oct 2025 20:56:16 +0000 Subject: [PATCH] typescripting --- src/hide-slop.ts | 8 ++++---- src/report-slop.ts | 4 ++-- tsconfig.json | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/hide-slop.ts b/src/hide-slop.ts index 566d6c5..8bf9c96 100644 --- a/src/hide-slop.ts +++ b/src/hide-slop.ts @@ -48,7 +48,7 @@ class ResultLinks extends Map { getSearchLinks() { // return an iterator over the nested SearchLink objects const domain_value_iterator = super.values() as MapIterator> - const search_link_iterator = domain_value_iterator.flatMap((domain_map) => { + const search_link_iterator = domain_value_iterator.flatMap((domain_map: Map) => { return domain_map.values() }) return search_link_iterator @@ -66,14 +66,14 @@ const page_links = new ResultLinks() function check_links(search_links: SearchLink[]) { // send a message to background script with a list of URLs to check - const urls = search_links.map((search_link) => { + const urls = search_links.map((search_link: SearchLink) => { search_link.checked = true return search_link.target }) - browser.runtime.sendMessage({type: "check", urls: urls.toArray()}) + browser.runtime.sendMessage({type: "check", urls: urls}) } -async function message_listener(message) { +async function message_listener(message: any) { // handle slop reports returned from the background script if(message.type === "check_result") { if (message.domain) { diff --git a/src/report-slop.ts b/src/report-slop.ts index 9af02b8..742f259 100644 --- a/src/report-slop.ts +++ b/src/report-slop.ts @@ -74,7 +74,7 @@ async function insert_slop(domain: string, path: string) { // is this domain already stored? const request = slop_store.get(domain) - request.onsuccess = (event) => { + request.onsuccess = () => { let result = request.result if (result) { // domain exists, add this path @@ -188,7 +188,7 @@ async function message_listener(message: any, sender: any) { let check_promises = new Array() let not_found_local = new Array() - message.urls.forEach((url) => { + message.urls.forEach((url: string) => { check_promises.push(check_local_slop(url).then(async (result) => { if (result.slop_domain) { browser.tabs.sendMessage(tabid, { type: "check_result", url: url, result: result }) diff --git a/tsconfig.json b/tsconfig.json index 24fb09e..e3de26a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,6 +4,6 @@ "outDir": "scripts", "noImplicitAny": true, "lib": ["ES2020", "DOM"], - "inlineSourceMap": true + "sourceMap": true } } \ No newline at end of file