Skip to content

Commit 539144c

Browse files
committed
Remove UnknownObject usage
1 parent 740da4f commit 539144c

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

src/run-uws-tracker.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ import {
3333
WebSocketsAccessSettings,
3434
} from "./settings.js";
3535

36-
type UnknownObject = Record<string, unknown>;
37-
3836
async function main(): Promise<void> {
3937
let settingsFileData: Buffer | undefined = undefined;
4038

@@ -56,13 +54,13 @@ async function main(): Promise<void> {
5654
}
5755
}
5856

59-
let jsonSettings: UnknownObject | undefined = undefined;
57+
let jsonSettings: Record<string, unknown> | undefined = undefined;
6058

6159
try {
6260
jsonSettings =
6361
settingsFileData === undefined
6462
? {}
65-
: (JSON.parse(settingsFileData.toString()) as UnknownObject);
63+
: (JSON.parse(settingsFileData.toString()) as Record<string, unknown>);
6664
} catch (e) {
6765
console.error("failed to parse JSON configuration file:", e);
6866
return;

src/settings.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,9 @@
1515
*/
1616

1717
/* eslint-disable no-console */
18-
19-
type UnknownObject = Record<string, unknown>;
20-
2118
export interface Settings {
2219
servers: ServerItemSettings[];
23-
tracker?: object;
20+
tracker?: Record<string, unknown>;
2421
websocketsAccess?: Partial<WebSocketsAccessSettings>;
2522
}
2623

@@ -54,7 +51,7 @@ export interface WebSocketsAccessSettings {
5451
}
5552

5653
export function validateSettings(
57-
jsonSettings: UnknownObject,
54+
jsonSettings: Record<string, unknown>,
5855
): Settings | undefined {
5956
if (
6057
jsonSettings.servers !== undefined &&
@@ -105,7 +102,7 @@ export function validateSettings(
105102

106103
return {
107104
servers,
108-
tracker: jsonSettings.tracker,
105+
tracker: jsonSettings.tracker as Record<string, unknown>,
109106
websocketsAccess: jsonSettings.websocketsAccess,
110107
};
111108
}

0 commit comments

Comments
 (0)