Convert ext updater to typescript

This commit is contained in:
hensm
2019-02-27 19:00:29 +00:00
parent 06044d9460
commit 076c8ce699
4 changed files with 91 additions and 35 deletions

12
ext/src/global.d.ts vendored
View File

@@ -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<void>;
removeListener (...args: any[]): void | Promise<void>;
}
}
declare namespace browser.runtime {
interface Port {
error: { message: string };
@@ -22,12 +30,14 @@ declare namespace browser.runtime {
}): browser.runtime.Port;
}
// Allow default attribute on <button>
declare namespace React {
interface ButtonHTMLAttributes<T> {
default?: boolean;
}
}
declare namespace JSX {
interface IntrinsicElements {
button: React.DetailedHTMLProps<