Skip to content

Commit

Permalink
Silenced various warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Chomp committed Jan 8, 2025
1 parent a7a92bd commit 61532d9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
1 change: 0 additions & 1 deletion project/src/generators/BotGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { BotHelper } from "@spt/helpers/BotHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
import { MinMax } from "@spt/models/common/MinMax";
import { IWildBody } from "@spt/models/eft/common/IGlobals";
import { IPmcData } from "@spt/models/eft/common/IPmcData";
import {
Common,
Expand Down
6 changes: 3 additions & 3 deletions project/src/helpers/InventoryHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export class InventoryHelper {
}
} catch (err) {
// Callback failed
const message =
const message: string =
typeof err?.message === "string" ? err.message : this.localisationService.getText("http-unknown_error");

this.httpResponse.appendErrorToOutput(output, message);
Expand Down Expand Up @@ -267,7 +267,7 @@ export class InventoryHelper {
findSlotResult.rotation,
);
} catch (err) {
const errorText = typeof err === "string" ? ` -> ${err}` : err.message;
const errorText: string = typeof err === "string" ? ` -> ${err}` : err.message;
this.logger.error(
this.localisationService.getText("inventory-unable_to_fit_item_into_inventory", errorText),
);
Expand Down Expand Up @@ -312,7 +312,7 @@ export class InventoryHelper {
findSlotResult.rotation,
);
} catch (err) {
const errorText = typeof err === "string" ? ` -> ${err}` : err.message;
const errorText: string = typeof err === "string" ? ` -> ${err}` : err.message;
this.logger.error(this.localisationService.getText("inventory-fill_container_failed", errorText));

return;
Expand Down
2 changes: 1 addition & 1 deletion project/src/helpers/ProfileHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ export class ProfileHelper {
* @returns An array of IItem objects representing the favorited data
*/
public getOtherProfileFavorites(profile: IPmcData): IItem[] {
let fullFavorites = [];
let fullFavorites: IItem[] = [];

for (const itemId of profile.Inventory.favoriteItems ?? []) {
// When viewing another users profile, the client expects a full item with children, so get that
Expand Down
15 changes: 8 additions & 7 deletions project/src/helpers/QuestHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { TraderHelper } from "@spt/helpers/TraderHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Common, IQuestStatus } from "@spt/models/eft/common/tables/IBotBase";
import { IItem } from "@spt/models/eft/common/tables/IItem";
import { IQuest, IQuestCondition } from "@spt/models/eft/common/tables/IQuest";
import { IQuest, IQuestCondition, IQuestReward } from "@spt/models/eft/common/tables/IQuest";
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
import { IAcceptQuestRequestData } from "@spt/models/eft/quests/IAcceptQuestRequestData";
import { ICompleteQuestRequestData } from "@spt/models/eft/quests/ICompleteQuestRequestData";
Expand Down Expand Up @@ -106,7 +106,7 @@ export class QuestHelper {
* @returns Reduction of cartesian product between two quest arrays
*/
public getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[] {
const knownQuestsIds = [];
const knownQuestsIds: string[] = [];
for (const q of before) {
knownQuestsIds.push(q._id);
}
Expand Down Expand Up @@ -784,7 +784,7 @@ export class QuestHelper {
continue;
}

const statusesDict = {};
const statusesDict: Record<QuestStatus, number> = {};
for (const status of statuses) {
statusesDict[status] = this.timeUtil.getTimestamp();
}
Expand All @@ -798,7 +798,8 @@ export class QuestHelper {
availableAfter: 0,
};

if (pmcProfile.Quests.some((x) => x.qid === questIdKey)) {
// Does quest already exist in profile
if (pmcProfile.Quests.some((questStatus) => questStatus.qid === questIdKey)) {
// Update existing
const existingQuest = pmcProfile.Quests.find((x) => x.qid === questIdKey);
existingQuest.status = questRecordToAdd.status;
Expand Down Expand Up @@ -1056,7 +1057,7 @@ export class QuestHelper {
for (const quest of modifiedQuests) {
// Remove any reward that doesn't pass the game edition check
for (const rewardType of Object.keys(quest.rewards)) {
quest.rewards[rewardType] = quest.rewards[rewardType].filter((reward) =>
quest.rewards[rewardType] = quest.rewards[rewardType].filter((reward: IQuestReward) =>
this.questRewardHelper.questRewardIsForGameEdition(reward, gameVersion),
);
}
Expand Down Expand Up @@ -1122,8 +1123,8 @@ export class QuestHelper {
this.failQuest(pmcData, failBody, sessionID, output);
}
} else {
// Failing an entirely new quest that doesnt exist in profile
const statusTimers = {};
// Failing an entirely new quest that doesn't exist in profile
const statusTimers: Record<QuestStatus, number> = {};
statusTimers[QuestStatus.Fail] = this.timeUtil.getTimestamp();
const questData: IQuestStatus = {
qid: questToFail._id,
Expand Down

0 comments on commit 61532d9

Please sign in to comment.