1
0
Fork 0

Add typing to playground.ts.

This commit is contained in:
Kitteh 2021-05-07 23:26:33 +01:00
parent 859717e482
commit 99cef8f26d
4 changed files with 10 additions and 9 deletions

View file

@ -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();

View file

@ -45,7 +45,7 @@ export async function prePageChecks(): Promise<boolean> {
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);

View file

@ -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<void> {
console.log("Welcome to Playground!");
window.pageState = pageState;
window.i18next = i18next;
(window as any).pageState = pageState;
(window as any).i18next = i18next;
}

View file

@ -1,7 +1,8 @@
{
"compilerOptions": {
"outDir": "./dist/",
"noImplicitAny": true,
"noImplicitAny": false,
"allowSyntheticDefaultImports": true,
"module": "es6",
"target": "es5",
"jsx": "react",