diff --git a/src/vector/indexeddb-worker.js b/src/vector/indexeddb-worker.ts similarity index 100% rename from src/vector/indexeddb-worker.js rename to src/vector/indexeddb-worker.ts diff --git a/src/vector/mobile_guide/index.js b/src/vector/mobile_guide/index.ts similarity index 91% rename from src/vector/mobile_guide/index.js rename to src/vector/mobile_guide/index.ts index 950ab956cba..f27d414f0a5 100644 --- a/src/vector/mobile_guide/index.js +++ b/src/vector/mobile_guide/index.ts @@ -1,19 +1,21 @@ import { getVectorConfig } from '../getconfig'; -function onBackToElementClick() { +function onBackToElementClick(): void { // Cookie should expire in 4 hours document.cookie = 'element_mobile_redirect_to_guide=false;path=/;max-age=14400'; window.location.href = '../'; } // NEVER pass user-controlled content to this function! Hardcoded strings only please. -function renderConfigError(message) { +function renderConfigError(message: string): void { const contactMsg = "If this is unexpected, please contact your system administrator " + "or technical support representative."; message = `

Error loading Element

${message}

${contactMsg}

`; const toHide = document.getElementsByClassName("mx_HomePage_container"); - const errorContainers = document.getElementsByClassName("mx_HomePage_errorContainer"); + const errorContainers = document.getElementsByClassName( + "mx_HomePage_errorContainer", + ) as HTMLCollectionOf; for (const e of toHide) { // We have to clear the content because .style.display='none'; doesn't work @@ -26,7 +28,7 @@ function renderConfigError(message) { } } -async function initPage() { +async function initPage(): Promise { document.getElementById('back_to_element_button').onclick = onBackToElementClick; const config = await getVectorConfig('..'); @@ -92,7 +94,7 @@ async function initPage() { if (isUrl && !isUrl.endsWith('/')) isUrl += '/'; if (hsUrl !== 'https://matrix.org/') { - document.getElementById('configure_element_button').href = + (document.getElementById('configure_element_button') as HTMLAnchorElement).href = "https://mobile.element.io?hs_url=" + encodeURIComponent(hsUrl) + "&is_url=" + encodeURIComponent(isUrl); document.getElementById('step1_heading').innerHTML= '1: Install the app'; diff --git a/webpack.config.js b/webpack.config.js index 1bc2124f68d..9d9d0172a6e 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -55,8 +55,8 @@ module.exports = (env, argv) => { entry: { "bundle": "./src/vector/index.ts", - "indexeddb-worker": "./src/vector/indexeddb-worker.js", - "mobileguide": "./src/vector/mobile_guide/index.js", + "indexeddb-worker": "./src/vector/indexeddb-worker.ts", + "mobileguide": "./src/vector/mobile_guide/index.ts", "jitsi": "./src/vector/jitsi/index.ts", "usercontent": "./node_modules/matrix-react-sdk/src/usercontent/index.js", "recorder-worklet": "./node_modules/matrix-react-sdk/src/voice/RecorderWorklet.ts",