diff --git a/src/client/HostLobbyModal.ts b/src/client/HostLobbyModal.ts
index a83e1e6c7..58bfd6aba 100644
--- a/src/client/HostLobbyModal.ts
+++ b/src/client/HostLobbyModal.ts
@@ -154,7 +154,9 @@ export class HostLobbyModal extends LitElement {
${maps.map((mapValue) => {
const mapKey = Object.keys(GameMapType).find(
- (key) => GameMapType[key] === mapValue,
+ (key) =>
+ GameMapType[key as keyof typeof GameMapType] ===
+ mapValue,
);
return html`
${translateText(
- `difficulty.${DifficultyDescription[key]}`,
+ `difficulty.${DifficultyDescription[key as keyof typeof DifficultyDescription]}`,
)}
@@ -589,7 +591,7 @@ export class HostLobbyModal extends LitElement {
await this.putGameConfig();
console.log(
- `Starting private game with map: ${GameMapType[this.selectedMap]} ${this.useRandomMap ? " (Randomly selected)" : ""}`,
+ `Starting private game with map: ${GameMapType[this.selectedMap as keyof typeof GameMapType]} ${this.useRandomMap ? " (Randomly selected)" : ""}`,
);
this.close();
const config = await getServerConfigFromClient();
diff --git a/src/client/Main.ts b/src/client/Main.ts
index 239f6184d..640ae8d93 100644
--- a/src/client/Main.ts
+++ b/src/client/Main.ts
@@ -58,6 +58,11 @@ declare global {
spaNewPage: (url: string) => void;
};
}
+
+ // Extend the global interfaces to include your custom events
+ interface DocumentEventMap {
+ "join-lobby": CustomEvent
;
+ }
}
export interface JoinLobbyEvent {
@@ -383,14 +388,18 @@ class Client {
window.addEventListener("popstate", onHashUpdate);
window.addEventListener("hashchange", onHashUpdate);
- function updateSliderProgress(slider) {
+ function updateSliderProgress(slider: HTMLInputElement) {
const percent =
- ((slider.value - slider.min) / (slider.max - slider.min)) * 100;
+ ((Number(slider.value) - Number(slider.min)) /
+ (Number(slider.max) - Number(slider.min))) *
+ 100;
slider.style.setProperty("--progress", `${percent}%`);
}
document
- .querySelectorAll("#bots-count, #private-lobby-bots-count")
+ .querySelectorAll(
+ "#bots-count, #private-lobby-bots-count",
+ )
.forEach((slider) => {
updateSliderProgress(slider);
slider.addEventListener("input", () => updateSliderProgress(slider));
diff --git a/src/client/SinglePlayerModal.ts b/src/client/SinglePlayerModal.ts
index a1e9c1a14..69f5b23cf 100644
--- a/src/client/SinglePlayerModal.ts
+++ b/src/client/SinglePlayerModal.ts
@@ -67,7 +67,9 @@ export class SinglePlayerModal extends LitElement {
${maps.map((mapValue) => {
const mapKey = Object.keys(GameMapType).find(
- (key) => GameMapType[key] === mapValue,
+ (key) =>
+ GameMapType[key as keyof typeof GameMapType] ===
+ mapValue,
);
return html`
${translateText(
- `difficulty.${DifficultyDescription[key]}`,
+ `difficulty.${DifficultyDescription[key as keyof typeof DifficultyDescription]}`,
)}
@@ -389,7 +391,7 @@ export class SinglePlayerModal extends LitElement {
}
console.log(
- `Starting single player game with map: ${GameMapType[this.selectedMap]}${this.useRandomMap ? " (Randomly selected)" : ""}`,
+ `Starting single player game with map: ${GameMapType[this.selectedMap as keyof typeof GameMapType]}${this.useRandomMap ? " (Randomly selected)" : ""}`,
);
const clientID = generateID();
const gameID = generateID();
diff --git a/src/client/graphics/layers/BuildMenu.ts b/src/client/graphics/layers/BuildMenu.ts
index 7644347fc..9399218e9 100644
--- a/src/client/graphics/layers/BuildMenu.ts
+++ b/src/client/graphics/layers/BuildMenu.ts
@@ -404,7 +404,7 @@ export class BuildMenu extends LitElement implements Layer {
return html`