Add typing to playground.ts.
This commit is contained in:
parent
859717e482
commit
99cef8f26d
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist/",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitAny": false,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"module": "es6",
|
||||
"target": "es5",
|
||||
"jsx": "react",
|
||||
|
|
Loading…
Reference in a new issue