Skip to content

Commit c00bf38

Browse files
committed
docs: better comments for PickingUpItem functions
1 parent 3d3df7e commit c00bf38

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

packages/isaacscript-common/src/types/PickingUpItem.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export function newPickingUpItem(): PickingUpItem {
5050
};
5151
}
5252

53+
/** Helper function to reset a `PickupUpItem` object to all 0 values. */
5354
export function resetPickingUpItem(pickingUpItem: PickingUpItem): void {
5455
pickingUpItem.itemType = DEFAULT_ITEM_TYPE;
5556
pickingUpItem.subType = DEFAULT_SUB_TYPE;
@@ -61,21 +62,27 @@ const COLLECTIBLE_ITEM_TYPES = new ReadonlySet<ItemType>([
6162
ItemType.FAMILIAR, // 4
6263
]);
6364

64-
/** Helper function to narrow the type of `PickingUpItem`. */
65+
/** Helper function to narrow the type of `PickingUpItem` to `ItemType.NULL` (0). */
6566
export function isPickingUpItemNull(
6667
pickingUpItem: PickingUpItem,
6768
): pickingUpItem is PickingUpItemTrinket {
6869
return pickingUpItem.itemType === ItemType.NULL;
6970
}
7071

71-
/** Helper function to narrow the type of `PickingUpItem`. */
72+
/**
73+
* Helper function to narrow the type of `PickingUpItem` to one of the following:
74+
*
75+
* - `ItemType.PASSIVE` (1)
76+
* - `ItemType.ACTIVE` (3)
77+
* - `ItemType.FAMILIAR` (4)
78+
*/
7279
export function isPickingUpItemCollectible(
7380
pickingUpItem: PickingUpItem,
7481
): pickingUpItem is PickingUpItemCollectible {
7582
return COLLECTIBLE_ITEM_TYPES.has(pickingUpItem.itemType);
7683
}
7784

78-
/** Helper function to narrow the type of `PickingUpItem`. */
85+
/** Helper function to narrow the type of `PickingUpItem` to `ItemType.TRINKET` (2). */
7986
export function isPickingUpItemTrinket(
8087
pickingUpItem: PickingUpItem,
8188
): pickingUpItem is PickingUpItemTrinket {

0 commit comments

Comments
 (0)