isaacscript-common 17.4.3 → 17.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/index.d.ts +13 -5
  2. package/dist/isaacscript-common.lua +23 -21
  3. package/dist/src/callbacks.d.ts +1 -1
  4. package/dist/src/classes/features/other/customStages/backdrop.d.ts.map +1 -1
  5. package/dist/src/classes/features/other/customStages/shadows.d.ts.map +1 -1
  6. package/dist/src/classes/features/other/customStages/streakText.d.ts.map +1 -1
  7. package/dist/src/classes/features/other/customStages/versusScreen.d.ts.map +1 -1
  8. package/dist/src/classes/features/other/customStages/versusScreen.lua +6 -10
  9. package/dist/src/functions/input.d.ts +11 -3
  10. package/dist/src/functions/input.d.ts.map +1 -1
  11. package/dist/src/functions/input.lua +18 -4
  12. package/dist/src/functions/roomShape.lua +0 -2
  13. package/dist/src/objects/LRoomShapeToRectangles.d.ts +5 -5
  14. package/dist/src/objects/LRoomShapeToRectangles.d.ts.map +1 -1
  15. package/dist/src/objects/backdropTypeToRockAltType.d.ts +60 -2
  16. package/dist/src/objects/backdropTypeToRockAltType.d.ts.map +1 -1
  17. package/dist/src/objects/bossNamePNGFileNames.d.ts +101 -2
  18. package/dist/src/objects/bossNamePNGFileNames.d.ts.map +1 -1
  19. package/dist/src/objects/bossPortraitPNGFileNames.d.ts +101 -2
  20. package/dist/src/objects/bossPortraitPNGFileNames.d.ts.map +1 -1
  21. package/dist/src/objects/cardDescriptions.d.ts +98 -2
  22. package/dist/src/objects/cardDescriptions.d.ts.map +1 -1
  23. package/dist/src/objects/cardNames.d.ts +98 -2
  24. package/dist/src/objects/cardNames.d.ts.map +1 -1
  25. package/dist/src/objects/challengeNames.d.ts +46 -2
  26. package/dist/src/objects/challengeNames.d.ts.map +1 -1
  27. package/dist/src/objects/characterDamageMultipliers.d.ts +42 -2
  28. package/dist/src/objects/characterDamageMultipliers.d.ts.map +1 -1
  29. package/dist/src/objects/characterNames.d.ts +42 -2
  30. package/dist/src/objects/characterNames.d.ts.map +1 -1
  31. package/dist/src/objects/coinSubTypeToValue.d.ts +8 -2
  32. package/dist/src/objects/coinSubTypeToValue.d.ts.map +1 -1
  33. package/dist/src/objects/directionNames.d.ts +5 -2
  34. package/dist/src/objects/directionNames.d.ts.map +1 -1
  35. package/dist/src/objects/directionToDegrees.d.ts +5 -2
  36. package/dist/src/objects/directionToDegrees.d.ts.map +1 -1
  37. package/dist/src/objects/directionToVector.d.ts +1 -1
  38. package/dist/src/objects/directionToVector.d.ts.map +1 -1
  39. package/dist/src/objects/doorSlotFlagToDoorSlot.d.ts +2 -2
  40. package/dist/src/objects/doorSlotFlagToDoorSlot.d.ts.map +1 -1
  41. package/dist/src/objects/doorSlotToDirection.d.ts +10 -2
  42. package/dist/src/objects/doorSlotToDirection.d.ts.map +1 -1
  43. package/dist/src/objects/doorSlotToDoorSlotFlag.d.ts +45 -2
  44. package/dist/src/objects/doorSlotToDoorSlotFlag.d.ts.map +1 -1
  45. package/dist/src/objects/isaacAPIClassTypeToBrand.d.ts +5 -2
  46. package/dist/src/objects/isaacAPIClassTypeToBrand.d.ts.map +1 -1
  47. package/dist/src/objects/isaacAPIClassTypeToFunctions.d.ts +1 -1
  48. package/dist/src/objects/languageNames.d.ts +7 -2
  49. package/dist/src/objects/languageNames.d.ts.map +1 -1
  50. package/dist/src/objects/oppositeDoorSlots.d.ts +9 -1
  51. package/dist/src/objects/oppositeDoorSlots.d.ts.map +1 -1
  52. package/dist/src/objects/pillEffectClasses.d.ts +51 -2
  53. package/dist/src/objects/pillEffectClasses.d.ts.map +1 -1
  54. package/dist/src/objects/pillEffectNames.d.ts +50 -2
  55. package/dist/src/objects/pillEffectNames.d.ts.map +1 -1
  56. package/dist/src/objects/pillEffectTypes.d.ts +51 -2
  57. package/dist/src/objects/pillEffectTypes.d.ts.map +1 -1
  58. package/dist/src/objects/playerNamePNGFileNames.d.ts +42 -2
  59. package/dist/src/objects/playerNamePNGFileNames.d.ts.map +1 -1
  60. package/dist/src/objects/playerPortraitPNGFileNames.d.ts +42 -2
  61. package/dist/src/objects/playerPortraitPNGFileNames.d.ts.map +1 -1
  62. package/dist/src/objects/roomShapeBounds.d.ts +1 -1
  63. package/dist/src/objects/roomShapeBounds.d.ts.map +1 -1
  64. package/dist/src/objects/roomShapeCorners.d.ts +1 -1
  65. package/dist/src/objects/roomShapeCorners.d.ts.map +1 -1
  66. package/dist/src/objects/roomShapeLayoutSizes.d.ts +1 -1
  67. package/dist/src/objects/roomShapeLayoutSizes.d.ts.map +1 -1
  68. package/dist/src/objects/roomShapeToBottomRightPosition.d.ts +1 -1
  69. package/dist/src/objects/roomShapeToBottomRightPosition.d.ts.map +1 -1
  70. package/dist/src/objects/roomShapeToDoorSlotCoordinates.d.ts +1 -1
  71. package/dist/src/objects/roomShapeToDoorSlotCoordinates.d.ts.map +1 -1
  72. package/dist/src/objects/roomShapeToDoorSlots.d.ts +1 -1
  73. package/dist/src/objects/roomShapeToDoorSlots.d.ts.map +1 -1
  74. package/dist/src/objects/roomShapeToDoorSlotsToGridIndexDelta.d.ts +1 -1
  75. package/dist/src/objects/roomShapeToDoorSlotsToGridIndexDelta.d.ts.map +1 -1
  76. package/dist/src/objects/roomShapeToGridWidth.d.ts +12 -2
  77. package/dist/src/objects/roomShapeToGridWidth.d.ts.map +1 -1
  78. package/dist/src/objects/roomShapeToTopLeftPosition.d.ts +1 -1
  79. package/dist/src/objects/roomShapeToTopLeftPosition.d.ts.map +1 -1
  80. package/dist/src/objects/roomShapeVolumes.d.ts +12 -2
  81. package/dist/src/objects/roomShapeVolumes.d.ts.map +1 -1
  82. package/dist/src/objects/roomTypeGotoPrefixes.d.ts +29 -2
  83. package/dist/src/objects/roomTypeGotoPrefixes.d.ts.map +1 -1
  84. package/dist/src/objects/roomTypeNames.d.ts +29 -2
  85. package/dist/src/objects/roomTypeNames.d.ts.map +1 -1
  86. package/dist/src/objects/stageTypeSuffixes.d.ts +6 -2
  87. package/dist/src/objects/stageTypeSuffixes.d.ts.map +1 -1
  88. package/dist/src/objects/stageTypeToLetter.d.ts +6 -2
  89. package/dist/src/objects/stageTypeToLetter.d.ts.map +1 -1
  90. package/dist/src/objects/transformationNames.d.ts +14 -2
  91. package/dist/src/objects/transformationNames.d.ts.map +1 -1
  92. package/dist/src/objects/versusScreenBackgroundColors.d.ts +1 -1
  93. package/dist/src/objects/versusScreenBackgroundColors.d.ts.map +1 -1
  94. package/dist/src/objects/versusScreenDirtSpotColors.d.ts +1 -1
  95. package/dist/src/objects/versusScreenDirtSpotColors.d.ts.map +1 -1
  96. package/dist/src/types/HasAllEnumKeys.d.ts +2 -2
  97. package/package.json +1 -1
  98. package/src/callbacks.ts +2 -2
  99. package/src/classes/features/other/customStages/backdrop.ts +4 -5
  100. package/src/classes/features/other/customStages/shadows.ts +3 -4
  101. package/src/classes/features/other/customStages/streakText.ts +3 -4
  102. package/src/classes/features/other/customStages/versusScreen.ts +4 -12
  103. package/src/functions/input.ts +19 -5
  104. package/src/objects/LRoomShapeToRectangles.ts +8 -6
  105. package/src/objects/backdropTypeToRockAltType.ts +3 -4
  106. package/src/objects/bossNamePNGFileNames.ts +3 -4
  107. package/src/objects/bossPortraitPNGFileNames.ts +3 -4
  108. package/src/objects/cardDescriptions.ts +3 -2
  109. package/src/objects/cardNames.ts +3 -2
  110. package/src/objects/challengeNames.ts +3 -2
  111. package/src/objects/characterDamageMultipliers.ts +3 -4
  112. package/src/objects/characterNames.ts +3 -2
  113. package/src/objects/coinSubTypeToValue.ts +3 -2
  114. package/src/objects/directionNames.ts +3 -4
  115. package/src/objects/directionToDegrees.ts +3 -4
  116. package/src/objects/directionToVector.ts +3 -1
  117. package/src/objects/doorSlotFlagToDoorSlot.ts +3 -4
  118. package/src/objects/doorSlotToDirection.ts +12 -12
  119. package/src/objects/doorSlotToDoorSlotFlag.ts +3 -4
  120. package/src/objects/isaacAPIClassTypeToBrand.ts +6 -4
  121. package/src/objects/isaacAPIClassTypeToFunctions.ts +3 -3
  122. package/src/objects/languageNames.ts +3 -4
  123. package/src/objects/oppositeDoorSlots.ts +3 -4
  124. package/src/objects/pillEffectClasses.ts +3 -4
  125. package/src/objects/pillEffectNames.ts +3 -2
  126. package/src/objects/pillEffectTypes.ts +3 -4
  127. package/src/objects/playerNamePNGFileNames.ts +3 -4
  128. package/src/objects/playerPortraitPNGFileNames.ts +3 -4
  129. package/src/objects/roomShapeBounds.ts +3 -1
  130. package/src/objects/roomShapeCorners.ts +3 -1
  131. package/src/objects/roomShapeLayoutSizes.ts +3 -1
  132. package/src/objects/roomShapeToBottomRightPosition.ts +8 -3
  133. package/src/objects/roomShapeToDoorSlotCoordinates.ts +3 -1
  134. package/src/objects/roomShapeToDoorSlots.ts +3 -1
  135. package/src/objects/roomShapeToDoorSlotsToGridIndexDelta.ts +3 -1
  136. package/src/objects/roomShapeToGridWidth.ts +3 -4
  137. package/src/objects/roomShapeToTopLeftPosition.ts +5 -3
  138. package/src/objects/roomShapeVolumes.ts +3 -4
  139. package/src/objects/roomTypeGotoPrefixes.ts +3 -4
  140. package/src/objects/roomTypeNames.ts +3 -2
  141. package/src/objects/stageTypeSuffixes.ts +3 -4
  142. package/src/objects/stageTypeToLetter.ts +3 -2
  143. package/src/objects/transformationNames.ts +3 -2
  144. package/src/objects/versusScreenBackgroundColors.ts +4 -2
  145. package/src/objects/versusScreenDirtSpotColors.ts +4 -2
  146. package/src/types/HasAllEnumKeys.ts +2 -2
@@ -2,12 +2,11 @@ import {
2
2
  ItemConfigPillEffectType,
3
3
  PillEffect,
4
4
  } from "isaac-typescript-definitions";
5
+ import { HasAllEnumKeys } from "../types/HasAllEnumKeys";
5
6
 
6
7
  export const DEFAULT_PILL_EFFECT_TYPE = ItemConfigPillEffectType.MODDED;
7
8
 
8
- export const PILL_EFFECT_TYPES: {
9
- readonly [key in PillEffect]: ItemConfigPillEffectType;
10
- } = {
9
+ export const PILL_EFFECT_TYPES = {
11
10
  [PillEffect.BAD_GAS]: ItemConfigPillEffectType.POSITIVE,
12
11
  [PillEffect.BAD_TRIP]: ItemConfigPillEffectType.NEGATIVE,
13
12
  [PillEffect.BALLS_OF_STEEL]: ItemConfigPillEffectType.POSITIVE,
@@ -59,4 +58,4 @@ export const PILL_EFFECT_TYPES: {
59
58
  [PillEffect.SHOT_SPEED_DOWN]: ItemConfigPillEffectType.NEGATIVE,
60
59
  [PillEffect.SHOT_SPEED_UP]: ItemConfigPillEffectType.POSITIVE,
61
60
  [PillEffect.EXPERIMENTAL]: ItemConfigPillEffectType.NEUTRAL,
62
- } as const;
61
+ } as const satisfies HasAllEnumKeys<PillEffect, ItemConfigPillEffectType>;
@@ -1,11 +1,10 @@
1
1
  // cspell:disable
2
2
 
3
3
  import { PlayerType } from "isaac-typescript-definitions";
4
+ import { HasAllEnumKeys } from "../types/HasAllEnumKeys";
4
5
 
5
6
  /** Used when rendering the "versusscreen.anm2" sprite. */
6
- export const PLAYER_NAME_PNG_FILE_NAMES: {
7
- readonly [key in PlayerType]: string | undefined;
8
- } = {
7
+ export const PLAYER_NAME_PNG_FILE_NAMES = {
9
8
  [PlayerType.POSSESSOR]: undefined, // -1
10
9
  [PlayerType.ISAAC]: "playername_01_isaac.png", // 0
11
10
  [PlayerType.MAGDALENE]: "playername_02_magdalene.png", // 1
@@ -55,4 +54,4 @@ export const PLAYER_NAME_PNG_FILE_NAMES: {
55
54
  [PlayerType.JACOB_2_B]: "playername_02x_jacob.png", // 39
56
55
  // Tainted The Soul uses the same name as Tainted Forgotten.
57
56
  [PlayerType.SOUL_B]: "playername_16_theforgotten.png", // 40
58
- } as const;
57
+ } as const satisfies HasAllEnumKeys<PlayerType, string | undefined>;
@@ -1,11 +1,10 @@
1
1
  // cspell:disable
2
2
 
3
3
  import { PlayerType } from "isaac-typescript-definitions";
4
+ import { HasAllEnumKeys } from "../types/HasAllEnumKeys";
4
5
 
5
6
  /** Used when rendering the "versusscreen.anm2" sprite. */
6
- export const PLAYER_PORTRAIT_PNG_FILE_NAMES: {
7
- readonly [key in PlayerType]: string | undefined;
8
- } = {
7
+ export const PLAYER_PORTRAIT_PNG_FILE_NAMES = {
9
8
  [PlayerType.POSSESSOR]: undefined, // -1
10
9
  [PlayerType.ISAAC]: "playerportrait_isaac.png", // 0
11
10
  [PlayerType.MAGDALENE]: "playerportrait_magdalene.png", // 1
@@ -52,4 +51,4 @@ export const PLAYER_PORTRAIT_PNG_FILE_NAMES: {
52
51
  [PlayerType.JACOB_2_B]: "playerportrait_jacob_b.png", // 39
53
52
  // Tainted The Soul uses the same name as Tainted Forgotten.
54
53
  [PlayerType.SOUL_B]: "playerportrait_theforgotten_b.png", // 40
55
- } as const;
54
+ } as const satisfies HasAllEnumKeys<PlayerType, string | undefined>;
@@ -15,8 +15,10 @@ const TWO_BY_TWO_BOUNDS: [width: int, height: int] = [
15
15
  * The size of a room shape's contents. This does not include the tiles that the walls are on. L
16
16
  * rooms use the same bounds as a 2x2 room.
17
17
  */
18
+ // We need the tuples to be read-only, so we specify the type instead of using the `satisfies`
19
+ // operator.
18
20
  export const ROOM_SHAPE_BOUNDS: {
19
- readonly [key in RoomShape]: readonly [width: int, height: int];
21
+ readonly [Key in RoomShape]: readonly [width: int, height: int];
20
22
  } = {
21
23
  // 1
22
24
  [RoomShape.SHAPE_1x1]: [
@@ -8,8 +8,10 @@ import { Corner } from "../interfaces/Corner";
8
8
  * Note that these corner locations are not accurate for the Mother Boss Room and the Home closet
9
9
  * rooms. (Those rooms have custom shapes.)
10
10
  */
11
+ // We need the arrays to be read-only, so we specify the type instead of using the `satisfies`
12
+ // operator.
11
13
  export const ROOM_SHAPE_CORNERS: {
12
- readonly [key in RoomShape]: readonly Corner[];
14
+ readonly [Key in RoomShape]: readonly Corner[];
13
15
  } = {
14
16
  // 1
15
17
  [RoomShape.SHAPE_1x1]: [
@@ -27,8 +27,10 @@ const TWO_BY_TWO_LAYOUT_SIZE: readonly [width: int, height: int] = [
27
27
  *
28
28
  * For example, a horizontal narrow room has a layout size of equal to that of a 1x1 room.
29
29
  */
30
+ // We need the tuples to be read-only, so we specify the type instead of using the `satisfies`
31
+ // operator.
30
32
  export const ROOM_SHAPE_LAYOUT_SIZES: {
31
- readonly [key in RoomShape]: readonly [width: int, height: int];
33
+ readonly [Key in RoomShape]: readonly [width: int, height: int];
32
34
  } = {
33
35
  [RoomShape.SHAPE_1x1]: ONE_BY_ONE_LAYOUT_SIZE, // 1
34
36
  [RoomShape.IH]: ONE_BY_ONE_LAYOUT_SIZE, // 2
@@ -1,14 +1,19 @@
1
1
  import { RoomShape } from "isaac-typescript-definitions";
2
2
 
3
- const TWO_BY_TWO_BOTTOM_RIGHT_POSITION = Vector(25, 13);
4
- const ONE_BY_TWO_VERTICAL_BOTTOM_RIGHT_POSITION = Vector(12, 13);
3
+ const TWO_BY_TWO_BOTTOM_RIGHT_POSITION: Readonly<Vector> = Vector(25, 13);
4
+ const ONE_BY_TWO_VERTICAL_BOTTOM_RIGHT_POSITION: Readonly<Vector> = Vector(
5
+ 12,
6
+ 13,
7
+ );
5
8
 
6
9
  /**
7
10
  * "Vector(0, 0)" corresponds to the top left tile of a room, not including the walls. (The top-left
8
11
  * wall would be at "Vector(-1, -1)".)
9
12
  */
13
+ // We need the vectors to be read-only, so we specify the type instead of using the `satisfies`
14
+ // operator.
10
15
  export const ROOM_SHAPE_TO_BOTTOM_RIGHT_POSITION: {
11
- readonly [key in RoomShape]: Readonly<Vector>;
16
+ readonly [Key in RoomShape]: Readonly<Vector>;
12
17
  } = {
13
18
  [RoomShape.SHAPE_1x1]: Vector(12, 6), // 1
14
19
  [RoomShape.IH]: Vector(12, 4), // 2
@@ -5,8 +5,10 @@ import { DoorSlot, RoomShape } from "isaac-typescript-definitions";
5
5
  *
6
6
  * e.g. `<door exists="False" x="-1" y="3" />`
7
7
  */
8
+ // We need the maps to be read-only, so we specify the type instead of using the `satisfies`
9
+ // operator.
8
10
  export const ROOM_SHAPE_TO_DOOR_SLOT_COORDINATES: {
9
- readonly [key in RoomShape]: ReadonlyMap<DoorSlot, [x: int, y: int]>;
11
+ readonly [Key in RoomShape]: ReadonlyMap<DoorSlot, [x: int, y: int]>;
10
12
  } = {
11
13
  // 1
12
14
  [RoomShape.SHAPE_1x1]: new Map([
@@ -11,8 +11,10 @@ const ALL_DOOR_SLOTS_SET: ReadonlySet<DoorSlot> = new Set([
11
11
  DoorSlot.DOWN_1, // 7
12
12
  ]);
13
13
 
14
+ // We need the sets to be read-only, so we specify the type instead of using the `satisfies`
15
+ // operator.
14
16
  export const ROOM_SHAPE_TO_DOOR_SLOTS: {
15
- readonly [key in RoomShape]: ReadonlySet<DoorSlot>;
17
+ readonly [Key in RoomShape]: ReadonlySet<DoorSlot>;
16
18
  } = {
17
19
  // 1
18
20
  [RoomShape.SHAPE_1x1]: new Set([
@@ -10,8 +10,10 @@ const DOWN = LEVEL_GRID_ROW_WIDTH;
10
10
  * Deltas are considered to be from the safe grid index of the room (i.e. the top left corner, or
11
11
  * top right corner in the case of `RoomShape.LTL`).
12
12
  */
13
+ // We need the maps to be read-only, so we specify the type instead of using the `satisfies`
14
+ // operator.
13
15
  export const ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA: {
14
- readonly [key in RoomShape]: Map<DoorSlot, int>;
16
+ readonly [Key in RoomShape]: ReadonlyMap<DoorSlot, int>;
15
17
  } = {
16
18
  // 1
17
19
  [RoomShape.SHAPE_1x1]: new Map([
@@ -1,11 +1,10 @@
1
1
  import { RoomShape } from "isaac-typescript-definitions";
2
+ import { HasAllEnumKeys } from "../types/HasAllEnumKeys";
2
3
 
3
4
  const ONE_BY_ONE_WIDTH = 15;
4
5
  const TWO_BY_ONE_WIDTH = 28;
5
6
 
6
- export const ROOM_SHAPE_TO_GRID_WIDTH: {
7
- readonly [key in RoomShape]: int;
8
- } = {
7
+ export const ROOM_SHAPE_TO_GRID_WIDTH = {
9
8
  [RoomShape.SHAPE_1x1]: ONE_BY_ONE_WIDTH, // 1
10
9
  [RoomShape.IH]: ONE_BY_ONE_WIDTH, // 2
11
10
  [RoomShape.IV]: ONE_BY_ONE_WIDTH, // 3
@@ -18,4 +17,4 @@ export const ROOM_SHAPE_TO_GRID_WIDTH: {
18
17
  [RoomShape.LTR]: TWO_BY_ONE_WIDTH, // 10
19
18
  [RoomShape.LBL]: TWO_BY_ONE_WIDTH, // 11
20
19
  [RoomShape.LBR]: TWO_BY_ONE_WIDTH, // 12
21
- } as const;
20
+ } as const satisfies HasAllEnumKeys<RoomShape, int>;
@@ -1,15 +1,17 @@
1
1
  import { RoomShape } from "isaac-typescript-definitions";
2
2
  import { VectorZero } from "../core/constants";
3
3
 
4
- const NARROW_HORIZONTAL_TOP_LEFT_POSITION = Vector(0, 2);
5
- const NARROW_VERTICAL_TOP_LEFT_POSITION = Vector(4, 0);
4
+ const NARROW_HORIZONTAL_TOP_LEFT_POSITION: Readonly<Vector> = Vector(0, 2);
5
+ const NARROW_VERTICAL_TOP_LEFT_POSITION: Readonly<Vector> = Vector(4, 0);
6
6
 
7
7
  /**
8
8
  * "Vector(0, 0)" corresponds to the top left tile of a room, not including the walls. (The top-left
9
9
  * wall would be at "Vector(-1, -1)".)
10
10
  */
11
+ // We need the vectors to be read-only, so we specify the type instead of using the `satisfies`
12
+ // operator.
11
13
  export const ROOM_SHAPE_TO_TOP_LEFT_POSITION: {
12
- readonly [key in RoomShape]: Readonly<Vector>;
14
+ readonly [Key in RoomShape]: Readonly<Vector>;
13
15
  } = {
14
16
  [RoomShape.SHAPE_1x1]: VectorZero, // 1
15
17
  [RoomShape.IH]: NARROW_HORIZONTAL_TOP_LEFT_POSITION, // 2
@@ -1,4 +1,5 @@
1
1
  import { RoomShape } from "isaac-typescript-definitions";
2
+ import { HasAllEnumKeys } from "../types/HasAllEnumKeys";
2
3
 
3
4
  export const ONE_BY_ONE_CONTENTS_WIDTH = 13;
4
5
  export const ONE_BY_ONE_CONTENTS_HEIGHT = 7;
@@ -20,9 +21,7 @@ const L_ROOM_VOLUME = ONE_BY_ONE_VOLUME * 3;
20
21
  *
21
22
  * (This cannot be directly calculated from the bounds since L rooms are a special case.)
22
23
  */
23
- export const ROOM_SHAPE_VOLUMES: {
24
- readonly [key in RoomShape]: int;
25
- } = {
24
+ export const ROOM_SHAPE_VOLUMES = {
26
25
  [RoomShape.SHAPE_1x1]: ONE_BY_ONE_VOLUME, // 1
27
26
  [RoomShape.IH]: NARROW_HORIZONTAL_VOLUME, // 2
28
27
  [RoomShape.IV]: NARROW_VERTICAL_VOLUME, // 3
@@ -35,4 +34,4 @@ export const ROOM_SHAPE_VOLUMES: {
35
34
  [RoomShape.LTR]: L_ROOM_VOLUME, // 10
36
35
  [RoomShape.LBL]: L_ROOM_VOLUME, // 11
37
36
  [RoomShape.LBR]: L_ROOM_VOLUME, // 12
38
- } as const;
37
+ } as const satisfies HasAllEnumKeys<RoomShape, int>;
@@ -1,8 +1,7 @@
1
1
  import { RoomType } from "isaac-typescript-definitions";
2
+ import { HasAllEnumKeys } from "../types/HasAllEnumKeys";
2
3
 
3
- export const ROOM_TYPE_GOTO_PREFIXES: {
4
- readonly [key in RoomType]: string;
5
- } = {
4
+ export const ROOM_TYPE_GOTO_PREFIXES = {
6
5
  [RoomType.DEFAULT]: "s.default", // 1
7
6
  [RoomType.SHOP]: "s.shop", // 2
8
7
  [RoomType.ERROR]: "s.error", // 3
@@ -32,4 +31,4 @@ export const ROOM_TYPE_GOTO_PREFIXES: {
32
31
  [RoomType.SECRET_EXIT]: "s.secretexit", // 27
33
32
  [RoomType.BLUE]: "s.blue", // 28
34
33
  [RoomType.ULTRA_SECRET]: "s.ultrasecret", // 29
35
- } as const;
34
+ } as const satisfies HasAllEnumKeys<RoomType, string>;
@@ -1,6 +1,7 @@
1
1
  import { RoomType } from "isaac-typescript-definitions";
2
+ import { HasAllEnumKeys } from "../types/HasAllEnumKeys";
2
3
 
3
- export const ROOM_TYPE_NAMES: { readonly [key in RoomType]: string } = {
4
+ export const ROOM_TYPE_NAMES = {
4
5
  [RoomType.DEFAULT]: "default room", // 1
5
6
  [RoomType.SHOP]: "shop", // 2
6
7
  [RoomType.ERROR]: "I AM ERROR Room", // 3
@@ -30,4 +31,4 @@ export const ROOM_TYPE_NAMES: { readonly [key in RoomType]: string } = {
30
31
  [RoomType.SECRET_EXIT]: "Secret Exit", // 27
31
32
  [RoomType.BLUE]: "Blue Room", // 28
32
33
  [RoomType.ULTRA_SECRET]: "Ultra Secret Room", // 29
33
- } as const;
34
+ } as const satisfies HasAllEnumKeys<RoomType, string>;
@@ -1,12 +1,11 @@
1
1
  import { StageType } from "isaac-typescript-definitions";
2
+ import { HasAllEnumKeys } from "../types/HasAllEnumKeys";
2
3
 
3
- export const STAGE_TYPE_SUFFIXES: {
4
- readonly [key in StageType]: string;
5
- } = {
4
+ export const STAGE_TYPE_SUFFIXES = {
6
5
  [StageType.ORIGINAL]: "", // 0
7
6
  [StageType.WRATH_OF_THE_LAMB]: "a", // 1
8
7
  [StageType.AFTERBIRTH]: "b", // 2
9
8
  [StageType.GREED_MODE]: "", // 3
10
9
  [StageType.REPENTANCE]: "c", // 4
11
10
  [StageType.REPENTANCE_B]: "d", // 5
12
- } as const;
11
+ } as const satisfies HasAllEnumKeys<StageType, string>;
@@ -1,6 +1,7 @@
1
1
  import { StageType } from "isaac-typescript-definitions";
2
+ import { HasAllEnumKeys } from "../types/HasAllEnumKeys";
2
3
 
3
- export const STAGE_TYPE_TO_LETTER: { readonly [key in StageType]: string } = {
4
+ export const STAGE_TYPE_TO_LETTER = {
4
5
  // For example, to go to Basement 2, the command is simply "stage 2" without a letter suffix.
5
6
  [StageType.ORIGINAL]: "", // 0
6
7
 
@@ -12,4 +13,4 @@ export const STAGE_TYPE_TO_LETTER: { readonly [key in StageType]: string } = {
12
13
 
13
14
  [StageType.REPENTANCE]: "c", // 4
14
15
  [StageType.REPENTANCE_B]: "d", // 5
15
- } as const;
16
+ } as const satisfies HasAllEnumKeys<StageType, string>;
@@ -1,6 +1,7 @@
1
1
  import { PlayerForm } from "isaac-typescript-definitions";
2
+ import { HasAllEnumKeys } from "../types/HasAllEnumKeys";
2
3
 
3
- export const TRANSFORMATION_NAMES: { readonly [key in PlayerForm]: string } = {
4
+ export const TRANSFORMATION_NAMES = {
4
5
  [PlayerForm.GUPPY]: "Guppy", // 0
5
6
  [PlayerForm.BEELZEBUB]: "Beelzebub", // 1
6
7
  [PlayerForm.FUN_GUY]: "Fun Guy", // 2
@@ -15,4 +16,4 @@ export const TRANSFORMATION_NAMES: { readonly [key in PlayerForm]: string } = {
15
16
  [PlayerForm.ADULT]: "Adult", // 11
16
17
  [PlayerForm.SPIDER_BABY]: "Spider Baby", // 12
17
18
  [PlayerForm.STOMPY]: "Stompy", // 13
18
- } as const;
19
+ } as const satisfies HasAllEnumKeys<PlayerForm, string>;
@@ -1,11 +1,13 @@
1
1
  import { StageID } from "isaac-typescript-definitions";
2
2
 
3
3
  /** We arbitrarily specify a default color equal to that of Basement. */
4
- const DEFAULT_COLOR = Color(26 / 255, 14 / 255, 12 / 255);
4
+ const DEFAULT_COLOR: Readonly<Color> = Color(26 / 255, 14 / 255, 12 / 255);
5
5
 
6
6
  /** These values are taken from StageAPI. */
7
+ // We need the colors to be read-only, so we specify the type instead of using the `satisfies`
8
+ // operator.
7
9
  export const VERSUS_SCREEN_BACKGROUND_COLORS: {
8
- readonly [key in StageID]: Color;
10
+ readonly [Key in StageID]: Readonly<Color>;
9
11
  } = {
10
12
  [StageID.SPECIAL_ROOMS]: DEFAULT_COLOR, // 0
11
13
  [StageID.BASEMENT]: Color(26 / 255, 14 / 255, 12 / 255), // 1
@@ -1,11 +1,13 @@
1
1
  import { StageID } from "isaac-typescript-definitions";
2
2
 
3
3
  /** We arbitrarily specify a default color equal to that of Basement. */
4
- const DEFAULT_COLOR = Color(201 / 255, 114 / 255, 96 / 255);
4
+ const DEFAULT_COLOR: Readonly<Color> = Color(201 / 255, 114 / 255, 96 / 255);
5
5
 
6
6
  /** These values are taken from StageAPI. */
7
+ // We need the colors to be read-only, so we specify the type instead of using the `satisfies`
8
+ // operator.
7
9
  export const VERSUS_SCREEN_DIRT_SPOT_COLORS: {
8
- readonly [key in StageID]: Color;
10
+ readonly [Key in StageID]: Readonly<Color>;
9
11
  } = {
10
12
  [StageID.SPECIAL_ROOMS]: DEFAULT_COLOR, // 0
11
13
  [StageID.BASEMENT]: Color(201 / 255, 114 / 255, 96 / 255), // 1
@@ -15,11 +15,11 @@
15
15
  * [MyEnum.Value1]: "foo",
16
16
  * [MyEnum.Value2]: "bar",
17
17
  * [MyEnum.Value3]: "baz",
18
- * } as const satisfies HasAllEnumKeys<MyEnum>;
18
+ * } as const satisfies HasAllEnumKeys<MyEnum, string>;
19
19
  *
20
20
  * const value = MyEnumToString[MyEnum.Value2];
21
21
  * ```
22
22
  */
23
23
  export type HasAllEnumKeys<Enum extends string | number, T> = {
24
- readonly [key in Enum]: T;
24
+ readonly [Key in Enum]: T;
25
25
  };