diff --git a/src/features/achievements/achievement.tsx b/src/features/achievements/achievement.tsx index 9bf454f..286e159 100644 --- a/src/features/achievements/achievement.tsx +++ b/src/features/achievements/achievement.tsx @@ -208,7 +208,7 @@ export function createAchievement( unref(achievement.earned) && !( display != null && - typeof display == "object" && + typeof display === "object" && "optionsDisplay" in (display as Record) ) ) { diff --git a/src/features/feature.ts b/src/features/feature.ts index 429629a..e829303 100644 --- a/src/features/feature.ts +++ b/src/features/feature.ts @@ -92,7 +92,7 @@ export function setDefault( key: K, value: T[K] ): asserts object is Exclude & Required> { - if (object[key] === undefined && value != undefined) { + if (object[key] == null && value != null) { object[key] = value; } } @@ -135,7 +135,7 @@ export function excludeFeatures(obj: Record, ...types: symbol[] if (value != null && typeof value === "object") { if ( // eslint-disable-next-line @typescript-eslint/no-explicit-any - typeof (value as Record).type == "symbol" && + typeof (value as Record).type === "symbol" && // eslint-disable-next-line @typescript-eslint/no-explicit-any !types.includes((value as Record).type) ) { diff --git a/src/features/grids/grid.ts b/src/features/grids/grid.ts index 454bbfc..ca2e3f7 100644 --- a/src/features/grids/grid.ts +++ b/src/features/grids/grid.ts @@ -128,7 +128,7 @@ function getCellHandler(id: string): ProxyHandler { if (isFunction(prop)) { return () => prop.call(receiver, id, target.getState(id)); } - if (prop != undefined || typeof key === "symbol") { + if (prop != null || typeof key === "symbol") { return prop; } @@ -145,7 +145,7 @@ function getCellHandler(id: string): ProxyHandler { cache[key] = computed(() => prop.call(receiver, id, target.getState(id))); } return cache[key].value; - } else if (prop != undefined) { + } else if (prop != null) { return unref(prop); } @@ -153,7 +153,7 @@ function getCellHandler(id: string): ProxyHandler { prop = (target as any)[`on${key}`]; if (isFunction(prop)) { return () => prop.call(receiver, id, target.getState(id)); - } else if (prop != undefined) { + } else if (prop != null) { return prop; } @@ -318,7 +318,7 @@ export function createGrid( return grid.id + "-" + cell; }; grid.getState = function (this: GenericGrid, cell: string | number) { - if (this.cellState.value[cell] != undefined) { + if (this.cellState.value[cell] != null) { return cellState.value[cell]; } return this.cells[cell].startState; diff --git a/src/features/trees/tree.ts b/src/features/trees/tree.ts index 5a03189..58c9db5 100644 --- a/src/features/trees/tree.ts +++ b/src/features/trees/tree.ts @@ -342,7 +342,7 @@ export const branchedResetPropagation = function ( if (links == null) return; const reset: GenericTreeNode[] = []; let current = [resettingNode]; - while (current.length != 0) { + while (current.length !== 0) { const next: GenericTreeNode[] = []; for (const node of current) { for (const link of links.filter(link => link.startNode === node)) { diff --git a/src/game/gameLoop.ts b/src/game/gameLoop.ts index b001dd6..9f5c5ca 100644 --- a/src/game/gameLoop.ts +++ b/src/game/gameLoop.ts @@ -43,7 +43,7 @@ function update() { loadingSave.value = false; // Add offline time if any - if (player.offlineTime != undefined) { + if (player.offlineTime != null) { if (Decimal.gt(player.offlineTime, projInfo.offlineLimit * 3600)) { player.offlineTime = projInfo.offlineLimit * 3600; } @@ -63,7 +63,7 @@ function update() { diff = Math.min(diff, projInfo.maxTickLength); // Apply dev speed - if (player.devSpeed != undefined) { + if (player.devSpeed != null) { diff *= player.devSpeed; } diff --git a/src/util/break_eternity.ts b/src/util/break_eternity.ts index dd6aed7..6734ece 100644 --- a/src/util/break_eternity.ts +++ b/src/util/break_eternity.ts @@ -26,7 +26,7 @@ export function exponentialFormat(num: DecimalSource, precision: number, mantiss } export function commaFormat(num: DecimalSource, precision: number): string { - if (num === null || num === undefined) { + if (num == null) { return "NaN"; } num = new Decimal(num); @@ -36,12 +36,12 @@ export function commaFormat(num: DecimalSource, precision: number): string { const init = num.toStringWithDecimalPlaces(precision); const portions = init.split("."); portions[0] = portions[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,"); - if (portions.length == 1) return portions[0]; + if (portions.length === 1) return portions[0]; return portions[0] + "." + portions[1]; } export function regularFormat(num: DecimalSource, precision: number): string { - if (num === null || num === undefined) { + if (num == null) { return "NaN"; } num = new Decimal(num); diff --git a/src/util/galaxy.ts b/src/util/galaxy.ts index 384ed3d..fdefe57 100644 --- a/src/util/galaxy.ts +++ b/src/util/galaxy.ts @@ -110,7 +110,7 @@ function syncSaves( } availableSlots.delete(cloudSave.slot); const localSaveId = settings.saves.find(id => id === cloudSave.content.id); - if (localSaveId == undefined) { + if (localSaveId == null) { settings.saves.push(cloudSave.content.id); save(setupInitialStore(cloudSave.content)); } else { diff --git a/src/util/vue.tsx b/src/util/vue.tsx index 3ba5f06..5f05618 100644 --- a/src/util/vue.tsx +++ b/src/util/vue.tsx @@ -191,7 +191,7 @@ export function computeOptionalComponent( watchEffect(() => { const currComponent = unwrapRef(component); comp.value = - currComponent == "" || currComponent == null + currComponent === "" || currComponent == null ? null : coerceComponent(currComponent, defaultWrapper); });