chore: require SlotNames in IInventoryChanges to be of type IBinChanges

This commit is contained in:
Sainan 2024-12-29 05:41:44 +01:00
parent 27af54d039
commit e909216001
2 changed files with 4 additions and 2 deletions

View File

@ -85,7 +85,7 @@ export const combineInventoryChanges = (InventoryChanges: IInventoryChanges, del
} else { } else {
console.assert(key.substring(-3) == "Bin"); console.assert(key.substring(-3) == "Bin");
const left = InventoryChanges[key] as IBinChanges; const left = InventoryChanges[key] as IBinChanges;
const right: IBinChanges = delta[key]; const right: IBinChanges = delta[key] as IBinChanges;
left.count += right.count; left.count += right.count;
left.platinum += right.platinum; left.platinum += right.platinum;
left.Slots += right.Slots; left.Slots += right.Slots;

View File

@ -17,7 +17,9 @@ export interface IPurchaseParams {
UseFreeFavor?: boolean; // for Source 2 UseFreeFavor?: boolean; // for Source 2
} }
export type IInventoryChanges = Record<string, IBinChanges | object[]>; export type IInventoryChanges = {
[_ in SlotNames]?: IBinChanges;
} & Record<string, IBinChanges | number | object[]>;
export interface IPurchaseResponse { export interface IPurchaseResponse {
InventoryChanges: IInventoryChanges; InventoryChanges: IInventoryChanges;