From 99cef8f26d50a5452b642d9bb430aecd7f92f96b Mon Sep 17 00:00:00 2001 From: Kitteh Date: Fri, 7 May 2021 23:26:33 +0100 Subject: [PATCH] Add typing to playground.ts. --- src/main.js | 2 +- src/pageUtils.ts | 6 +++--- src/{playground.js => playground.ts} | 8 ++++---- tsconfig.json | 3 ++- 4 files changed, 10 insertions(+), 9 deletions(-) rename src/{playground.js => playground.ts} (64%) diff --git a/src/main.js b/src/main.js index 1fd67b1..220d2a4 100644 --- a/src/main.js +++ b/src/main.js @@ -105,7 +105,7 @@ async function onLoad() { window.pageContent = document.querySelector("#pageContent"); if (process.env.NODE_ENV == "development") { - await (await import("./playground.js")).playground(); + await (await import("./playground.ts")).playground(); } renderPage(); diff --git a/src/pageUtils.ts b/src/pageUtils.ts index 40d57e3..512d0af 100644 --- a/src/pageUtils.ts +++ b/src/pageUtils.ts @@ -45,7 +45,7 @@ export async function prePageChecks(): Promise { export function addClipboardNotifications(clipboard: ClipboardJS, timeout = 1000): void { - clipboard.on('success', _ => { + clipboard.on('success', () => { (UIkit as any).notification(i18next.t("notification_copy_success"), { status: 'success', timeout: timeout @@ -116,7 +116,7 @@ export function setTitleElement(pageState: PageState): void { makeElement({ tag: "a", text: pageState.currentBaseMount + " ", - onclick: _ => { + onclick: () => { pageState.currentSecretPath = []; pageState.currentSecret = ""; pageState.currentSecretVersion = null; @@ -134,7 +134,7 @@ export function setTitleElement(pageState: PageState): void { return makeElement({ tag: "a", text: secretPath + " ", - onclick: _ => { + onclick: () => { pageState.currentSecretVersion = null; if (pageState.currentMountType.startsWith("kv")) { pageState.currentSecretPath = secretPaths.slice(0, index + 1); diff --git a/src/playground.js b/src/playground.ts similarity index 64% rename from src/playground.js rename to src/playground.ts index ed8ab01..ee43e7a 100644 --- a/src/playground.js +++ b/src/playground.ts @@ -1,4 +1,4 @@ -import { pageState } from "./globalPageState.ts"; +import { pageState } from "./globalPageState"; import i18next from 'i18next'; // Playground is a way to debug and test things. @@ -7,8 +7,8 @@ import i18next from 'i18next'; // Also it only runs when process.env.NODE_ENV == "development" // Please empty this function before committing. -export async function playground() { +export async function playground(): Promise { console.log("Welcome to Playground!"); - window.pageState = pageState; - window.i18next = i18next; + (window as any).pageState = pageState; + (window as any).i18next = i18next; } diff --git a/tsconfig.json b/tsconfig.json index 5d0e373..1cb4723 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,8 @@ { "compilerOptions": { "outDir": "./dist/", - "noImplicitAny": true, + "noImplicitAny": false, + "allowSyntheticDefaultImports": true, "module": "es6", "target": "es5", "jsx": "react",