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

+1 -1
View File
@@ -24,7 +24,7 @@ async function loadDatabase(config: lib.ControllerConfig, logger: lib.Logger) {
async function saveDatabase(
controllerConfig: lib.ControllerConfig,
playerDatastore: Map<string, IpcPlayerData>,
playerDatastore: Map<string, IpcPlayerData> | undefined,
logger: lib.Logger,
) {
if (playerDatastore) {
+1 -1
View File
@@ -57,7 +57,7 @@ async function loadDatabase(
async function saveDatabase(
controllerConfig: lib.ControllerConfig,
items: lib.ItemDatabase,
items: lib.ItemDatabase | undefined,
logger: lib.Logger,
) {
if (items && items.size < 50000) {
+2 -2
View File
@@ -134,7 +134,7 @@ export function doleDivider(
// Update existing items if item name already exists
if (itemCount > object.count) {
// If successful, increase dole
_doleDivisionFactor[object.name] = Math.max((_doleDivisionFactor[object.name] || 0) || 1, 1) - 1;
_doleDivisionFactor[object.name] = Math.max(_doleDivisionFactor[object.name] || 1, 1) - 1;
items.removeItem(object.name, object.count);
prometheusDoleFactorGauge.labels(object.name).set(_doleDivisionFactor[object.name] || 0);
@@ -143,7 +143,7 @@ export function doleDivider(
// if we didn't have enough, attempt giving out a smaller amount next time
_doleDivisionFactor[object.name] = Math.min(
maxDoleDivision, Math.max((_doleDivisionFactor[object.name] || 0) || 1, 1) * 2
maxDoleDivision, Math.max(_doleDivisionFactor[object.name] || 1, 1) * 2
);
prometheusDoleFactorGauge.labels(object.name).set(_doleDivisionFactor[object.name] || 0);
return 0;