mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-30 18:01:17 +00:00
Fix type errors in /server related to typescript strict mode (#1468)
## Description: Task: #1075 Enable typescript strict mode First (out of many) PR in order to enable typescript Strict mode in the project. This PR fixes all type issues present under the `/server` path. ## Specifics Most changes are just basic type fixes, however here are some further explanation for some of the more complex changes: 1. `PatternDecoder.ts` used to accept `Uint8Array` as an input, however this was never used, so to simplify the typing and avoid casting in various places, I just removed support for it. 2. `MapPlaylist.ts` has a `frequency` object with map names, used to specify how often each map should appear in the playlist. However this list is not in sync with the actual map list, so some maps were missing from that list. I fixed that while adding stronger typing for the future. Also removed an un-necessary call to `parseInt`. ## 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 - [x] I have read and accepted the CLA aggreement (only required once). ## Please put your Discord username so you can be contacted if a bug or regression is found: azlod
This commit is contained in:
@@ -5,10 +5,7 @@ export class PatternDecoder {
|
||||
readonly width: number;
|
||||
readonly scale: number;
|
||||
|
||||
constructor(
|
||||
base64: string,
|
||||
base64urlDecode: (input: Uint8Array | string) => Uint8Array,
|
||||
) {
|
||||
constructor(base64: string, base64urlDecode: (input: string) => Uint8Array) {
|
||||
this.bytes = base64urlDecode(base64);
|
||||
|
||||
if (this.bytes.length < 3) {
|
||||
|
||||
@@ -84,6 +84,8 @@ export enum GameMapType {
|
||||
Italia = "Italia",
|
||||
}
|
||||
|
||||
export type GameMapName = keyof typeof GameMapType;
|
||||
|
||||
export const mapCategories: Record<string, GameMapType[]> = {
|
||||
continental: [
|
||||
GameMapType.World,
|
||||
|
||||
Reference in New Issue
Block a user