From 79943a67d8bf095c8836ab7202a7b6ca445400cf Mon Sep 17 00:00:00 2001 From: Miodec Date: Tue, 15 Feb 2022 15:26:45 +0100 Subject: [PATCH] converted modes notice to ts --- .../elements/{modes-notice.js => modes-notice.ts} | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) rename frontend/src/scripts/elements/{modes-notice.js => modes-notice.ts} (92%) diff --git a/frontend/src/scripts/elements/modes-notice.js b/frontend/src/scripts/elements/modes-notice.ts similarity index 92% rename from frontend/src/scripts/elements/modes-notice.js rename to frontend/src/scripts/elements/modes-notice.ts index 8de7f662e..fc6e5f4b8 100644 --- a/frontend/src/scripts/elements/modes-notice.js +++ b/frontend/src/scripts/elements/modes-notice.ts @@ -4,8 +4,9 @@ import * as DB from "../db"; import Config from "../config"; import * as TestWords from "../test/test-words"; import * as ConfigEvent from "../observables/config-event"; +import * as MonkeyTypes from "../types/interfaces"; -ConfigEvent.subscribe((eventKey, eventValue) => { +ConfigEvent.subscribe((eventKey) => { if ( [ "difficulty", @@ -23,7 +24,7 @@ ConfigEvent.subscribe((eventKey, eventValue) => { } }); -export function update() { +export function update(): void { let anim = false; if ($(".pageTest #testModesNotice").text() === "") anim = true; @@ -43,7 +44,10 @@ export function update() { if (TestState.activeChallenge) { $(".pageTest #testModesNotice").append( - `
${TestState.activeChallenge.display}
` + // remove as any once test state is in ts + `
${ + (TestState.activeChallenge as any).display + }
` ); } @@ -88,7 +92,7 @@ export function update() { ) { let speed = ""; try { - speed = ` (${Math.round(PaceCaret.settings.wpm)} wpm)`; + speed = ` (${Math.round((PaceCaret.settings as any).wpm)} wpm)`; //remove as any once pace caret is ts } catch {} $(".pageTest #testModesNotice").append( `
${ @@ -166,7 +170,7 @@ export function update() { let tagsString = ""; try { - DB.getSnapshot().tags.forEach((tag) => { + DB.getSnapshot().tags.forEach((tag: MonkeyTypes.Tag) => { if (tag.active === true) { tagsString += tag.name + ", "; }