From 076c8ce69975205537307ff7c2e852db8e4d8da1 Mon Sep 17 00:00:00 2001 From: hensm Date: Wed, 27 Feb 2019 19:00:29 +0000 Subject: [PATCH] Convert ext updater to typescript --- ext/src/global.d.ts | 12 ++- ext/src/types.ts | 17 +++++ ext/src/updater/{index.jsx => index.tsx} | 95 ++++++++++++++++-------- ext/webpack.config.js | 2 +- 4 files changed, 91 insertions(+), 35 deletions(-) rename ext/src/updater/{index.jsx => index.tsx} (82%) diff --git a/ext/src/global.d.ts b/ext/src/global.d.ts index 6c6bb32..d579c2f 100644 --- a/ext/src/global.d.ts +++ b/ext/src/global.d.ts @@ -1,3 +1,4 @@ +// Define replacement types declare const EXTENSION_NAME: string; declare const EXTENSION_ID: string; declare const EXTENSION_VERSION: string; @@ -5,12 +6,19 @@ declare const MIRRORING_APP_ID: string; declare const APPLICATION_NAME: string; declare const APPLICATION_VERSION: string; + // Fix issues with @types/firefox-webext-browser declare namespace browser.events { + /** + * Shouldn't enforce limited function signature across all + * event types. + */ interface Event { - addListener (...args: any[]): void; + addListener (...args: any[]): void | Promise; + removeListener (...args: any[]): void | Promise; } } + declare namespace browser.runtime { interface Port { error: { message: string }; @@ -22,12 +30,14 @@ declare namespace browser.runtime { }): browser.runtime.Port; } + // Allow default attribute on