Fix bad typings detected by linting

Fix badly typed expressions that were detected by turning on
`@typescript-eslint/no-unnecessary-condition` in eslint.
This commit is contained in:
Hornwitser committed 2023-12-02 01:47:02 +01:00
1 parent 90a88f7e01
commit ec734c92bc
29 files changed
+62 -73

No files matched your search

+2 -2
View File
@@ -230,10 +230,10 @@ export default class ControlConnection extends BaseConnection {
await hostConfig.init();
hostConfig.set("host.controller_url", this._controller.getControllerUrl());
if (request.id !== null) {
if (request.id !== undefined) {
hostConfig.set("host.id", request.id);
}
if (request.name !== null) {
if (request.name !== undefined) {
hostConfig.set("host.name", request.name);
}
if (request.generateToken) {
+2 -2
View File
@@ -656,7 +656,7 @@ export default class Controller {
host.name,
host.id,
this.wsServer.hostConnections.has(host.id),
host.public_address === null ? undefined : host.public_address,
host.public_address,
host.token_valid_after,
);
@@ -778,7 +778,7 @@ export default class Controller {
// Assign to target
instance.config.set("instance.assigned_host", hostId);
this.instancesDirty = true;
if (hostId !== null && newHostConnection) {
if (hostId !== undefined && newHostConnection) {
await newHostConnection.send(
new lib.InstanceAssignInternalRequest(instanceId, instance.config.serialize("host"))
);
+1 -3
View File
@@ -284,9 +284,7 @@ export default class HostConnection extends BaseConnection {
this._controller.userManager.notifyLeave(user, instanceId);
}
if (event.stats) {
user.instanceStats.set(instanceId, event.stats);
}
user.instanceStats.set(instanceId, event.stats);
user.recalculatePlayerStats();
this._controller.userUpdated(user);