strictNullChecks

This commit is contained in:
Scott Anderson
2025-04-07 05:12:09 -04:00
parent aac1cf0754
commit 3b07f78e97
82 changed files with 582 additions and 423 deletions
+20 -2
View File
@@ -170,7 +170,7 @@ app.get(
);
async function fetchLobbies(): Promise<number> {
const fetchPromises = [];
const fetchPromises: Promise<GameInfo | null>[] = [];
for (const gameID of publicLobbyIDs) {
const controller = new AbortController();
@@ -209,8 +209,26 @@ async function fetchLobbies(): Promise<number> {
});
lobbyInfos.forEach((l) => {
if (l.msUntilStart <= 250 || l.gameConfig.maxPlayers <= l.numClients) {
if (
"msUntilStart" in l &&
typeof l.msUntilStart !== "undefined" &&
l.msUntilStart <= 250
) {
publicLobbyIDs.delete(l.gameID);
return;
}
if (
"gameConfig" in l &&
typeof l.gameConfig !== "undefined" &&
"maxPlayers" in l.gameConfig &&
typeof l.gameConfig.maxPlayers !== "undefined" &&
"numClients" in l &&
typeof l.numClients !== "undefined" &&
l.gameConfig.maxPlayers <= l.numClients
) {
publicLobbyIDs.delete(l.gameID);
return;
}
});