TypeScript update to 6.0.3 (#3806)

## Description:

Updating TypeScript to 6.0.3.
Updating TypeScript-eslint to 8.59.1 for TS6 support.
Concurrently needed to get updated as well to remove deprecated warning.

Most things deleted are now just defaults.

## 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

## Please put your Discord username so you can be contacted if a bug or
regression is found:

Babyboucher
This commit is contained in:
babyboucher
2026-04-30 16:49:24 -05:00
committed by GitHub
parent 742a544a69
commit 4f20d2b332
15 changed files with 256 additions and 246 deletions
+8
View File
@@ -220,6 +220,14 @@ declare global {
"start-game": CustomEvent;
"join-changed": CustomEvent;
"open-matchmaking": CustomEvent<undefined>;
userMeResponse: CustomEvent<UserMeResponse | false>;
"leave-lobby": CustomEvent;
"update-game-config": CustomEvent;
}
// Fixes the globalThis.addEventListener errors
interface WindowEventMap {
"event:user-settings-changed:settings.darkMode": CustomEvent<string>;
}
}
+1 -1
View File
@@ -123,7 +123,7 @@ export class MatchmakingModal extends BaseModal {
this.gameCheckInterval = setInterval(() => this.checkGame(), 1000);
}
};
this.socket.onerror = (event: ErrorEvent) => {
this.socket.onerror = (event: Event) => {
console.error("WebSocket error occurred:", event);
};
this.socket.onclose = () => {
+1 -1
View File
@@ -4,7 +4,7 @@ import { customElement, query } from "lit/decorators.js";
import { PlayerType } from "../../../core/game/Game";
import { GameView, PlayerView } from "../../../core/game/GameView";
import quickChatData from "resources/QuickChat.json" with { type: "json" };
import quickChatData from "resources/QuickChat.json";
import { EventBus } from "../../../core/EventBus";
import { CloseViewEvent } from "../../InputHandler";
import { SendQuickChatEvent } from "../../Transport";
@@ -510,7 +510,7 @@ export class PerformanceOverlay extends LitElement implements Layer {
if (!this.isUserSettingsListenerAttached) {
globalThis.addEventListener(
`${USER_SETTINGS_CHANGED_EVENT}:${PERFORMANCE_OVERLAY_KEY}`,
this.onUserSettingsChanged,
this.onUserSettingsChanged as EventListener,
);
this.isUserSettingsListenerAttached = true;
}
@@ -522,7 +522,7 @@ export class PerformanceOverlay extends LitElement implements Layer {
if (this.isUserSettingsListenerAttached) {
globalThis.removeEventListener(
`${USER_SETTINGS_CHANGED_EVENT}:${PERFORMANCE_OVERLAY_KEY}`,
this.onUserSettingsChanged,
this.onUserSettingsChanged as EventListener,
);
this.isUserSettingsListenerAttached = false;
}
@@ -306,7 +306,7 @@ export class SpriteFactory {
structureType: UnitType,
isConstruction: boolean,
isMarkedForDeletion: boolean,
shape: string,
shape: keyof typeof ICON_SIZE,
renderIcon: boolean,
): PIXI.Texture {
const structureCanvas = document.createElement("canvas");
+2 -1
View File
@@ -40,6 +40,7 @@ import {
} from "./Game";
import { GameMap, TileRef } from "./GameMap";
import { GameUpdate, GameUpdateType } from "./GameUpdates";
import { UnitView } from "./GameView";
import { MotionPlanRecord, packMotionPlans } from "./MotionPlans";
import { PlayerImpl } from "./PlayerImpl";
import { RailNetwork } from "./RailNetwork";
@@ -1002,7 +1003,7 @@ export class GameImpl implements Game {
tile,
searchRange,
types,
predicate,
predicate as (unit: Unit | UnitView) => boolean,
playerId,
includeUnderConstruction,
);
+2 -1
View File
@@ -25,6 +25,7 @@ import {
Tick,
TrainType,
TransportShipState,
Unit,
UnitInfo,
UnitType,
WarshipState,
@@ -1151,7 +1152,7 @@ export class GameView implements GameMap {
tile,
searchRange,
types,
predicate,
predicate as (unit: Unit | UnitView) => boolean,
playerId,
includeUnderConstruction,
);
+2 -1
View File
@@ -113,7 +113,8 @@ export class RailNetworkImpl implements RailNetwork {
for (const cluster of this.dirtyClusters) {
const allOriginalStations = new Set(cluster.stations);
while (allOriginalStations.size > 0) {
const nextStation = allOriginalStations.values().next().value;
const nextStation = allOriginalStations.values().next()
.value as TrainStation;
const allConnectedStations = this.computeCluster(nextStation);
// Filter stations that are connected to the current cluster
for (const connectedStation of allConnectedStations) {
+1 -1
View File
@@ -106,5 +106,5 @@ export interface Stats {
trainSelfTrade(player: Player, gold: number | bigint): void;
// Another player's train arrives at own station
trainExternalTrade(player: Player, goldPlayer: number | bigint);
trainExternalTrade(player: Player, goldPlayer: number | bigint): void;
}
+9 -1
View File
@@ -9,6 +9,11 @@ type Span = {
const stack: Span[] = [];
declare global {
var __DEBUG_SPAN_ENABLED__: boolean | undefined;
var __DEBUG_SPANS__: Span[];
}
function isEnabled(): boolean {
return globalThis.__DEBUG_SPAN_ENABLED__ === true;
}
@@ -82,7 +87,10 @@ export const DebugSpan = {
);
};
const properties = {
const properties: {
timings: Record<string, number | undefined>;
data: Record<string, any>;
} = {
timings: { total: span.duration },
data: extractData(span),
};
+6 -3
View File
@@ -176,21 +176,24 @@ export class PrivilegeCheckerImpl implements PrivilegeChecker {
refs.patternColorPaletteName ?? null,
);
} catch (e) {
return { type: "forbidden", reason: "invalid pattern: " + e.message };
const message = e instanceof Error ? e.message : String(e);
return { type: "forbidden", reason: "invalid pattern: " + message };
}
}
if (refs.color) {
try {
cosmetics.color = this.isColorAllowed(flares, refs.color);
} catch (e) {
return { type: "forbidden", reason: "invalid color: " + e.message };
const message = e instanceof Error ? e.message : String(e);
return { type: "forbidden", reason: "invalid color: " + message };
}
}
if (refs.flag) {
try {
cosmetics.flag = this.isFlagAllowed(flares, refs.flag);
} catch (e) {
return { type: "forbidden", reason: "invalid flag: " + e.message };
const message = e instanceof Error ? e.message : String(e);
return { type: "forbidden", reason: "invalid flag: " + message };
}
}