From be841a3de341489f09ea676d3980a933afc39da4 Mon Sep 17 00:00:00 2001 From: Refringe Date: Thu, 16 Nov 2023 10:11:31 -0500 Subject: [PATCH] Resolves Type Issue in ProfileFixerService When attempting to access a property/type that *shouldn't* exist (on purpose) it has to be cast to the type manually, else annoying type error. --- project/src/services/ProfileFixerService.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/project/src/services/ProfileFixerService.ts b/project/src/services/ProfileFixerService.ts index 59731787..1351825d 100644 --- a/project/src/services/ProfileFixerService.ts +++ b/project/src/services/ProfileFixerService.ts @@ -6,6 +6,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { TraderHelper } from "@spt-aki/helpers/TraderHelper"; import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; +import { IHideoutImprovement } from "@spt-aki/models/eft/common/tables/IBotBase"; import { Bonus, HideoutSlot, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests"; import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea"; @@ -1145,10 +1146,10 @@ export class ProfileFixerService */ protected migrateImprovements(pmcProfile: IPmcData): void { - if (pmcProfile.Hideout.Improvements) + if ("Improvements" in pmcProfile.Hideout) { - // Correct name is `Improvement` - pmcProfile.Hideout.Improvement = this.jsonUtil.clone(pmcProfile.Hideout.Improvements); + const improvements = pmcProfile.Hideout.Improvements as Record; + pmcProfile.Hideout.Improvement = this.jsonUtil.clone(improvements); delete pmcProfile.Hideout.Improvements; this.logger.success("Successfully migrated hideout Improvements data to new location, deleted old data"); }