From 2afe5109127a68cb12f9716ad302e338c378a0bd Mon Sep 17 00:00:00 2001 From: Max Baumann Date: Tue, 15 Dec 2020 20:10:19 +0100 Subject: [PATCH] refactor(types): add PageElements type --- src/popup.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/popup.ts b/src/popup.ts index 5fb87bcf..b5d83e6c 100644 --- a/src/popup.ts +++ b/src/popup.ts @@ -37,6 +37,8 @@ class MessageHandler { } } + + //make this a function to allow this to run on the content page async function runThePopup(messageListener?: MessageListener): Promise { const messageHandler = new MessageHandler(messageListener); @@ -45,7 +47,14 @@ async function runThePopup(messageListener?: MessageListener): Promise { await utils.wait(() => Config.config !== null); - const PageElements: any = {}; + type InputPageElements = { + whitelistToggle?: HTMLInputElement, + toggleSwitch?: HTMLInputElement, + usernameInput?: HTMLInputElement, + }; + type PageElements = { [key: string]: HTMLElement } & InputPageElements + + const PageElements: PageElements = {}; [ "sponsorblockPopup",