chore: fix non-string concat warnings

This commit is contained in:
Sainan 2024-12-30 00:07:53 +01:00
parent 1c436d9466
commit 9455703bdc
3 changed files with 5 additions and 5 deletions

View File

@ -9,7 +9,7 @@ export const focusController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
switch (req.query.op) { switch (req.query.op) {
default: default:
logger.error("Unhandled focus op type: " + req.query.op); logger.error("Unhandled focus op type: " + String(req.query.op));
logger.debug(String(req.body)); logger.debug(String(req.body));
res.end(); res.end();
break; break;

View File

@ -29,17 +29,17 @@ export const gildWeaponController: RequestHandler = async (req, res) => {
const data = getJSONfromString(String(req.body)) as IGildWeaponRequest; const data = getJSONfromString(String(req.body)) as IGildWeaponRequest;
data.ItemId = String(req.query.ItemId); data.ItemId = String(req.query.ItemId);
if (!modularWeaponCategory.includes(req.query.Category as WeaponTypeInternal | "Hoverboards")) { if (!modularWeaponCategory.includes(req.query.Category as WeaponTypeInternal | "Hoverboards")) {
throw new Error(`Unknown modular weapon Category: ${req.query.Category}`); throw new Error(`Unknown modular weapon Category: ${String(req.query.Category)}`);
} }
data.Category = req.query.Category as WeaponTypeInternal | "Hoverboards"; data.Category = req.query.Category as WeaponTypeInternal | "Hoverboards";
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
if (!inventory[data.Category]) { if (!inventory[data.Category]) {
throw new Error(`Category ${req.query.Category} not found in inventory`); throw new Error(`Category ${String(req.query.Category)} not found in inventory`);
} }
const weaponIndex = inventory[data.Category].findIndex(x => String(x._id) === data.ItemId); const weaponIndex = inventory[data.Category].findIndex(x => String(x._id) === data.ItemId);
if (weaponIndex === -1) { if (weaponIndex === -1) {
throw new Error(`Weapon with ${data.ItemId} not found in category ${req.query.Category}`); throw new Error(`Weapon with ${data.ItemId} not found in category ${String(req.query.Category)}`);
} }
const weapon = inventory[data.Category][weaponIndex]; const weapon = inventory[data.Category][weaponIndex];

View File

@ -111,7 +111,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
break; break;
default: default:
throw new Error(`unhandled infestedFoundry mode: ${req.query.mode}`); throw new Error(`unhandled infestedFoundry mode: ${String(req.query.mode)}`);
} }
}; };