Skip to content

Commit

Permalink
fix(types): use correct state types in utils
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyckahn committed Aug 3, 2023
1 parent 1e00c95 commit c936467
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -760,14 +760,14 @@ export const sortItems = items => {

export const inventorySpaceConsumed = memoize(
/**
* @param {farmhand.item[]} inventory
* @param {farmhand.state['inventory']} inventory
* @returns {number}
*/
inventory => inventory.reduce((sum, { quantity = 0 }) => sum + quantity, 0)
)

/**
* @param {{ inventory: Array.<farmhand.item>, inventoryLimit: number}} state
* @param {farmhand.state} state
* @returns {number}
*/
export const inventorySpaceRemaining = ({ inventory, inventoryLimit }) =>
Expand All @@ -776,11 +776,11 @@ export const inventorySpaceRemaining = ({ inventory, inventoryLimit }) =>
: Math.max(0, inventoryLimit - inventorySpaceConsumed(inventory))

/**
* @param {{ inventory: Array.<farmhand.item>, inventoryLimit: number}} state
* @param {farmhand.state} state
* @returns {boolean}
*/
export const doesInventorySpaceRemain = ({ inventory, inventoryLimit }) =>
inventorySpaceRemaining({ inventory, inventoryLimit }) > 0
export const doesInventorySpaceRemain = state =>
inventorySpaceRemaining(state) > 0

/**
* @param {Array.<farmhand.item>} inventory
Expand Down

0 comments on commit c936467

Please sign in to comment.