strict mode: GameInfoSchema.parse (#1763)

## Description:

Update the code for strict mode.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [ ] I have read and accepted the CLA agreement (only required once).
This commit is contained in:
Scott Anderson
2025-08-09 03:20:50 -04:00
committed by GitHub
parent 7e25f6b910
commit be073330a6
2 changed files with 5 additions and 1 deletions
+2
View File
@@ -18,6 +18,7 @@ import {
ClientInfo,
GameConfig,
GameInfo,
GameInfoSchema,
TeamCountConfig,
} from "../core/Schemas";
import { generateID } from "../core/Util";
@@ -671,6 +672,7 @@ export class HostLobbyModal extends LitElement {
},
})
.then((response) => response.json())
.then(GameInfoSchema.parse)
.then((data: GameInfo) => {
console.log(`got game info response: ${JSON.stringify(data)}`);
+3 -1
View File
@@ -1,7 +1,7 @@
import { LitElement, html } from "lit";
import { customElement, query, state } from "lit/decorators.js";
import { translateText } from "../client/Utils";
import { GameInfo } from "../core/Schemas";
import { GameInfo, GameInfoSchema } from "../core/Schemas";
import { generateID } from "../core/Util";
import {
WorkerApiArchivedGameLobbySchema,
@@ -11,6 +11,7 @@ import { getServerConfigFromClient } from "../core/configuration/ConfigLoader";
import { JoinLobbyEvent } from "./Main";
import "./components/baseComponents/Button";
import "./components/baseComponents/Modal";
@customElement("join-private-lobby-modal")
export class JoinPrivateLobbyModal extends LitElement {
@query("o-modal") private modalEl!: HTMLElement & {
@@ -285,6 +286,7 @@ export class JoinPrivateLobbyModal extends LitElement {
},
)
.then((response) => response.json())
.then(GameInfoSchema.parse)
.then((data: GameInfo) => {
this.players = data.clients?.map((p) => p.username) ?? [];
})