Refactor background page to use Typescript

Also, this CL adds clean-terminal-webpack-plugin to make it easier to
debug Typescript errors while developing the extension.

Bug: translateselectedtext:15
Change-Id: If9b97cb7508859e2e05f5dc82940808fd935bf1a
diff --git a/src/options/credits.json5 b/src/options/credits.json5
index 6572988..56220e2 100644
--- a/src/options/credits.json5
+++ b/src/options/credits.json5
@@ -17,6 +17,18 @@
     "license": "MIT License"
   },
   {
+    "name": "chrome-types",
+    "url": "https://github.com/GoogleChrome/chrome-types",
+    "author": "Google LLC",
+    "license": "Apache-2.0 License"
+  },
+  {
+    "name": "clean-terminal-webpack-plugin",
+    "url": "https://github.com/danillouz/clean-terminal-webpack-plugin",
+    "author": "Daniël Illouz",
+    "license": "MIT License"
+  },
+  {
     "name": "clean-webpack-plugin",
     "url": "https://github.com/johnagan/clean-webpack-plugin",
     "author": "John Agan",
diff --git a/src/options/elements/credits-dialog/credits-dialog.js b/src/options/elements/credits-dialog/credits-dialog.js
index abec000..e7c3b10 100644
--- a/src/options/elements/credits-dialog/credits-dialog.js
+++ b/src/options/elements/credits-dialog/credits-dialog.js
@@ -2,11 +2,11 @@
 import {map} from 'lit/directives/map.js';
 import {unsafeHTML} from 'lit/directives/unsafe-html.js';
 
-import {msg} from '../../../common/i18n.js';
+import {msg} from '../../../common/i18n';
 import credits from '../../credits.json5';
 import i18nCredits from '../../i18n-credits.json5';
-import {DIALOG_STYLES} from '../../shared/dialog-styles.js';
-import {SHARED_STYLES} from '../../shared/shared-styles.js';
+import {DIALOG_STYLES} from '../../shared/dialog-styles';
+import {SHARED_STYLES} from '../../shared/shared-styles';
 
 export class CreditsDialog extends LitElement {
   static get styles() {
diff --git a/src/options/elements/options-editor/add-language-dialog.js b/src/options/elements/options-editor/add-language-dialog.js
index 7b85618..4cfd711 100644
--- a/src/options/elements/options-editor/add-language-dialog.js
+++ b/src/options/elements/options-editor/add-language-dialog.js
@@ -1,9 +1,9 @@
 import {css, html, LitElement} from 'lit';
 
-import {isoLangs} from '../../../common/consts.js';
-import {msg} from '../../../common/i18n.js';
-import {DIALOG_STYLES} from '../../shared/dialog-styles.js';
-import {SHARED_STYLES} from '../../shared/shared-styles.js';
+import {isoLangs} from '../../../common/consts';
+import {msg} from '../../../common/i18n';
+import {DIALOG_STYLES} from '../../shared/dialog-styles';
+import {SHARED_STYLES} from '../../shared/shared-styles';
 
 const ALL_LANGUAGES =
     Object.entries(isoLangs)
diff --git a/src/options/elements/options-editor/languages-editor.js b/src/options/elements/options-editor/languages-editor.js
index 4265d50..76d9967 100644
--- a/src/options/elements/options-editor/languages-editor.js
+++ b/src/options/elements/options-editor/languages-editor.js
@@ -1,11 +1,11 @@
 import {css, html, LitElement} from 'lit';
 import {map} from 'lit/directives/map.js';
 
-import {isoLangs} from '../../../common/consts.js';
-import {msg} from '../../../common/i18n.js';
-import {SHARED_STYLES} from '../../shared/shared-styles.js';
+import {isoLangs} from '../../../common/consts';
+import {msg} from '../../../common/i18n';
+import {SHARED_STYLES} from '../../shared/shared-styles';
 
-import AddLanguageDialog from './add-language-dialog.js';
+import AddLanguageDialog from './add-language-dialog';
 
 export class LanguagesEditor extends LitElement {
   static properties = {
diff --git a/src/options/elements/options-editor/options-editor.js b/src/options/elements/options-editor/options-editor.js
index 9592d27..a26072e 100644
--- a/src/options/elements/options-editor/options-editor.js
+++ b/src/options/elements/options-editor/options-editor.js
@@ -1,11 +1,11 @@
 import {css, html, LitElement} from 'lit';
 import {map} from 'lit/directives/map.js';
 
-import {msg} from '../../../common/i18n.js';
-import {TAB_OPTIONS} from '../../../common/options.js';
-import {SHARED_STYLES} from '../../shared/shared-styles.js';
+import {msg} from '../../../common/i18n';
+import {TAB_OPTIONS} from '../../../common/options';
+import {SHARED_STYLES} from '../../shared/shared-styles';
 
-import LanguagesEditor from './languages-editor.js';
+import LanguagesEditor from './languages-editor';
 
 export class OptionsEditor extends LitElement {
   static properties = {
diff --git a/src/options/options.js b/src/options/options.js
index 7a16ef9..2dd9dca 100644
--- a/src/options/options.js
+++ b/src/options/options.js
@@ -1,11 +1,11 @@
 import {css, html, LitElement} from 'lit';
 
-import {msg} from '../common/i18n.js';
-import Options from '../common/options.js';
+import {msg} from '../common/i18n';
+import Options from '../common/options';
 
-import CreditsDialog from './elements/credits-dialog/credits-dialog.js';
-import OptionsEditor from './elements/options-editor/options-editor.js';
-import {SHARED_STYLES} from './shared/shared-styles.js';
+import CreditsDialog from './elements/credits-dialog/credits-dialog';
+import OptionsEditor from './elements/options-editor/options-editor';
+import {SHARED_STYLES} from './shared/shared-styles';
 
 let bodyStyles = document.createElement('style');
 // #!if browser_target == 'chromium'