isaacscript-common 33.13.0 → 33.14.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.
package/dist/index.rollup.d.ts
CHANGED
|
@@ -1131,36 +1131,52 @@ export declare function arrayToBitFlags<T extends BitFlag | BitFlag128>(array: T
|
|
|
1131
1131
|
export declare function arrayToString(array: unknown[]): string;
|
|
1132
1132
|
|
|
1133
1133
|
/**
|
|
1134
|
-
* Helper function to safely cast
|
|
1134
|
+
* Helper function to safely cast an `int` to a `CardType`. (This is better than using the `as`
|
|
1135
1135
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
1136
1136
|
*
|
|
1137
1137
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
1138
1138
|
*/
|
|
1139
|
-
export declare function asCardType(num:
|
|
1139
|
+
export declare function asCardType(num: int): CardType;
|
|
1140
1140
|
|
|
1141
1141
|
/**
|
|
1142
|
-
* Helper function to safely cast
|
|
1142
|
+
* Helper function to safely cast an `int` to a `CollectibleType`. (This is better than using the
|
|
1143
1143
|
* `as` TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
1144
1144
|
*
|
|
1145
1145
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
1146
1146
|
*/
|
|
1147
|
-
export declare function asCollectibleType(num:
|
|
1147
|
+
export declare function asCollectibleType(num: int): CollectibleType;
|
|
1148
1148
|
|
|
1149
1149
|
/**
|
|
1150
|
-
* Helper function to safely cast
|
|
1150
|
+
* Helper function to safely cast an enum to an `int`. (This is better than using the `as`
|
|
1151
1151
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
1152
1152
|
*
|
|
1153
1153
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
1154
1154
|
*/
|
|
1155
|
-
export declare function
|
|
1155
|
+
export declare function asFloat(num: number): float;
|
|
1156
1156
|
|
|
1157
1157
|
/**
|
|
1158
|
-
* Helper function to safely cast
|
|
1158
|
+
* Helper function to safely cast an enum to an `int`. (This is better than using the `as`
|
|
1159
1159
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
1160
1160
|
*
|
|
1161
1161
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
1162
1162
|
*/
|
|
1163
|
-
export declare function
|
|
1163
|
+
export declare function asInt(num: number): int;
|
|
1164
|
+
|
|
1165
|
+
/**
|
|
1166
|
+
* Helper function to safely cast an `int` to a `LevelStage`. (This is better than using the `as`
|
|
1167
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
1168
|
+
*
|
|
1169
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
1170
|
+
*/
|
|
1171
|
+
export declare function asLevelStage(num: int): LevelStage;
|
|
1172
|
+
|
|
1173
|
+
/**
|
|
1174
|
+
* Helper function to safely cast an `int` to a `NPCState`. (This is better than using the `as`
|
|
1175
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
1176
|
+
*
|
|
1177
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
1178
|
+
*/
|
|
1179
|
+
export declare function asNPCState(num: int): NPCState;
|
|
1164
1180
|
|
|
1165
1181
|
/**
|
|
1166
1182
|
* Helper function to safely cast an enum to a `number`. (This is better than using the `as`
|
|
@@ -1171,28 +1187,28 @@ export declare function asNPCState(num: number): NPCState;
|
|
|
1171
1187
|
export declare function asNumber(num: number): number;
|
|
1172
1188
|
|
|
1173
1189
|
/**
|
|
1174
|
-
* Helper function to safely cast
|
|
1190
|
+
* Helper function to safely cast an `int` to a `PillColor`. (This is better than using the `as`
|
|
1175
1191
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
1176
1192
|
*
|
|
1177
1193
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
1178
1194
|
*/
|
|
1179
|
-
export declare function asPillColor(num:
|
|
1195
|
+
export declare function asPillColor(num: int): PillColor;
|
|
1180
1196
|
|
|
1181
1197
|
/**
|
|
1182
|
-
* Helper function to safely cast
|
|
1198
|
+
* Helper function to safely cast an `int` to a `PillEffect`. (This is better than using the `as`
|
|
1183
1199
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
1184
1200
|
*
|
|
1185
1201
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
1186
1202
|
*/
|
|
1187
|
-
export declare function asPillEffect(num:
|
|
1203
|
+
export declare function asPillEffect(num: int): PillEffect;
|
|
1188
1204
|
|
|
1189
1205
|
/**
|
|
1190
|
-
* Helper function to safely cast
|
|
1206
|
+
* Helper function to safely cast an `int` to a `PlayerType`. (This is better than using the `as`
|
|
1191
1207
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
1192
1208
|
*
|
|
1193
1209
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
1194
1210
|
*/
|
|
1195
|
-
export declare function asPlayerType(num:
|
|
1211
|
+
export declare function asPlayerType(num: int): PlayerType;
|
|
1196
1212
|
|
|
1197
1213
|
/**
|
|
1198
1214
|
* Helper function to throw an error (using the `error` Lua function) if the provided value is equal
|
|
@@ -1213,12 +1229,12 @@ export declare function assertDefined<T>(value: T, ...[msg]: [undefined] extends
|
|
|
1213
1229
|
export declare function asString(str: string): string;
|
|
1214
1230
|
|
|
1215
1231
|
/**
|
|
1216
|
-
* Helper function to safely cast
|
|
1232
|
+
* Helper function to safely cast an `int` to a `TrinketType`. (This is better than using the `as`
|
|
1217
1233
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
1218
1234
|
*
|
|
1219
1235
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
1220
1236
|
*/
|
|
1221
|
-
export declare function asTrinketType(num:
|
|
1237
|
+
export declare function asTrinketType(num: int): TrinketType;
|
|
1222
1238
|
|
|
1223
1239
|
/**
|
|
1224
1240
|
* The distance of the laser when Azazel does not have any range up items yet. For more info, see
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 33.
|
|
3
|
+
isaacscript-common 33.14.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -15731,6 +15731,12 @@ end
|
|
|
15731
15731
|
function ____exports.asCollectibleType(self, num)
|
|
15732
15732
|
return num
|
|
15733
15733
|
end
|
|
15734
|
+
function ____exports.asFloat(self, num)
|
|
15735
|
+
return num
|
|
15736
|
+
end
|
|
15737
|
+
function ____exports.asInt(self, num)
|
|
15738
|
+
return num
|
|
15739
|
+
end
|
|
15734
15740
|
function ____exports.asLevelStage(self, num)
|
|
15735
15741
|
return num
|
|
15736
15742
|
end
|
|
@@ -2,33 +2,47 @@
|
|
|
2
2
|
/// <reference types="lua-types/5.3" />
|
|
3
3
|
import type { CardType, CollectibleType, LevelStage, NPCState, PillColor, PillEffect, PlayerType, TrinketType } from "isaac-typescript-definitions";
|
|
4
4
|
/**
|
|
5
|
-
* Helper function to safely cast
|
|
5
|
+
* Helper function to safely cast an `int` to a `CardType`. (This is better than using the `as`
|
|
6
6
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
7
7
|
*
|
|
8
8
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
9
9
|
*/
|
|
10
|
-
export declare function asCardType(num:
|
|
10
|
+
export declare function asCardType(num: int): CardType;
|
|
11
11
|
/**
|
|
12
|
-
* Helper function to safely cast
|
|
12
|
+
* Helper function to safely cast an `int` to a `CollectibleType`. (This is better than using the
|
|
13
13
|
* `as` TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
14
14
|
*
|
|
15
15
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
16
16
|
*/
|
|
17
|
-
export declare function asCollectibleType(num:
|
|
17
|
+
export declare function asCollectibleType(num: int): CollectibleType;
|
|
18
18
|
/**
|
|
19
|
-
* Helper function to safely cast
|
|
19
|
+
* Helper function to safely cast an enum to an `int`. (This is better than using the `as`
|
|
20
20
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
21
21
|
*
|
|
22
22
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
23
23
|
*/
|
|
24
|
-
export declare function
|
|
24
|
+
export declare function asFloat(num: number): float;
|
|
25
25
|
/**
|
|
26
|
-
* Helper function to safely cast
|
|
26
|
+
* Helper function to safely cast an enum to an `int`. (This is better than using the `as`
|
|
27
27
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
28
28
|
*
|
|
29
29
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
30
30
|
*/
|
|
31
|
-
export declare function
|
|
31
|
+
export declare function asInt(num: number): int;
|
|
32
|
+
/**
|
|
33
|
+
* Helper function to safely cast an `int` to a `LevelStage`. (This is better than using the `as`
|
|
34
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
35
|
+
*
|
|
36
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
37
|
+
*/
|
|
38
|
+
export declare function asLevelStage(num: int): LevelStage;
|
|
39
|
+
/**
|
|
40
|
+
* Helper function to safely cast an `int` to a `NPCState`. (This is better than using the `as`
|
|
41
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
42
|
+
*
|
|
43
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
44
|
+
*/
|
|
45
|
+
export declare function asNPCState(num: int): NPCState;
|
|
32
46
|
/**
|
|
33
47
|
* Helper function to safely cast an enum to a `number`. (This is better than using the `as`
|
|
34
48
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
@@ -37,26 +51,26 @@ export declare function asNPCState(num: number): NPCState;
|
|
|
37
51
|
*/
|
|
38
52
|
export declare function asNumber(num: number): number;
|
|
39
53
|
/**
|
|
40
|
-
* Helper function to safely cast
|
|
54
|
+
* Helper function to safely cast an `int` to a `PillColor`. (This is better than using the `as`
|
|
41
55
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
42
56
|
*
|
|
43
57
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
44
58
|
*/
|
|
45
|
-
export declare function asPillColor(num:
|
|
59
|
+
export declare function asPillColor(num: int): PillColor;
|
|
46
60
|
/**
|
|
47
|
-
* Helper function to safely cast
|
|
61
|
+
* Helper function to safely cast an `int` to a `PillEffect`. (This is better than using the `as`
|
|
48
62
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
49
63
|
*
|
|
50
64
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
51
65
|
*/
|
|
52
|
-
export declare function asPillEffect(num:
|
|
66
|
+
export declare function asPillEffect(num: int): PillEffect;
|
|
53
67
|
/**
|
|
54
|
-
* Helper function to safely cast
|
|
68
|
+
* Helper function to safely cast an `int` to a `PlayerType`. (This is better than using the `as`
|
|
55
69
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
56
70
|
*
|
|
57
71
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
58
72
|
*/
|
|
59
|
-
export declare function asPlayerType(num:
|
|
73
|
+
export declare function asPlayerType(num: int): PlayerType;
|
|
60
74
|
/**
|
|
61
75
|
* Helper function to safely cast an enum to a `string`. (This is better than using the `as`
|
|
62
76
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
@@ -65,12 +79,12 @@ export declare function asPlayerType(num: number): PlayerType;
|
|
|
65
79
|
*/
|
|
66
80
|
export declare function asString(str: string): string;
|
|
67
81
|
/**
|
|
68
|
-
* Helper function to safely cast
|
|
82
|
+
* Helper function to safely cast an `int` to a `TrinketType`. (This is better than using the `as`
|
|
69
83
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
70
84
|
*
|
|
71
85
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
72
86
|
*/
|
|
73
|
-
export declare function asTrinketType(num:
|
|
87
|
+
export declare function asTrinketType(num: int): TrinketType;
|
|
74
88
|
export declare function isBoolean(variable: unknown): variable is boolean;
|
|
75
89
|
export declare function isFunction(variable: unknown): variable is Function;
|
|
76
90
|
export declare function isInteger(variable: unknown): variable is int;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/functions/types.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EACV,QAAQ,EACR,eAAe,EACf,UAAU,EACV,QAAQ,EACR,SAAS,EACT,UAAU,EACV,UAAU,EACV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAEtC;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/functions/types.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EACV,QAAQ,EACR,eAAe,EACf,UAAU,EACV,QAAQ,EACR,SAAS,EACT,UAAU,EACV,UAAU,EACV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAEtC;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,QAAQ,CAE7C;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,GAAG,eAAe,CAE3D;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAE1C;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAEtC;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,UAAU,CAEjD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,QAAQ,CAE7C;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,SAAS,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,UAAU,CAEjD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,UAAU,CAEjD;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,WAAW,CAEnD;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,OAAO,CAEhE;AAGD,wBAAgB,UAAU,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,QAAQ,CAElE;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,GAAG,CAM5D;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,MAAM,CAE9D;AAED,+EAA+E;AAC/E,wBAAgB,WAAW,CACzB,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,OAAO,GAAG,MAAM,GAAG,MAAM,CAOvC;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,MAAM,CAE9D;AAED,wBAAgB,OAAO,CACrB,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAExC;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,WAAW,CAErE"}
|
|
@@ -2,28 +2,42 @@ local ____exports = {}
|
|
|
2
2
|
function ____exports.isNumber(self, variable)
|
|
3
3
|
return type(variable) == "number"
|
|
4
4
|
end
|
|
5
|
-
--- Helper function to safely cast
|
|
5
|
+
--- Helper function to safely cast an `int` to a `CardType`. (This is better than using the `as`
|
|
6
6
|
-- TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
7
7
|
--
|
|
8
8
|
-- This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
9
9
|
function ____exports.asCardType(self, num)
|
|
10
10
|
return num
|
|
11
11
|
end
|
|
12
|
-
--- Helper function to safely cast
|
|
12
|
+
--- Helper function to safely cast an `int` to a `CollectibleType`. (This is better than using the
|
|
13
13
|
-- `as` TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
14
14
|
--
|
|
15
15
|
-- This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
16
16
|
function ____exports.asCollectibleType(self, num)
|
|
17
17
|
return num
|
|
18
18
|
end
|
|
19
|
-
--- Helper function to safely cast
|
|
19
|
+
--- Helper function to safely cast an enum to an `int`. (This is better than using the `as`
|
|
20
|
+
-- TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
21
|
+
--
|
|
22
|
+
-- This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
23
|
+
function ____exports.asFloat(self, num)
|
|
24
|
+
return num
|
|
25
|
+
end
|
|
26
|
+
--- Helper function to safely cast an enum to an `int`. (This is better than using the `as`
|
|
27
|
+
-- TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
28
|
+
--
|
|
29
|
+
-- This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
30
|
+
function ____exports.asInt(self, num)
|
|
31
|
+
return num
|
|
32
|
+
end
|
|
33
|
+
--- Helper function to safely cast an `int` to a `LevelStage`. (This is better than using the `as`
|
|
20
34
|
-- TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
21
35
|
--
|
|
22
36
|
-- This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
23
37
|
function ____exports.asLevelStage(self, num)
|
|
24
38
|
return num
|
|
25
39
|
end
|
|
26
|
-
--- Helper function to safely cast
|
|
40
|
+
--- Helper function to safely cast an `int` to a `NPCState`. (This is better than using the `as`
|
|
27
41
|
-- TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
28
42
|
--
|
|
29
43
|
-- This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
@@ -37,21 +51,21 @@ end
|
|
|
37
51
|
function ____exports.asNumber(self, num)
|
|
38
52
|
return num
|
|
39
53
|
end
|
|
40
|
-
--- Helper function to safely cast
|
|
54
|
+
--- Helper function to safely cast an `int` to a `PillColor`. (This is better than using the `as`
|
|
41
55
|
-- TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
42
56
|
--
|
|
43
57
|
-- This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
44
58
|
function ____exports.asPillColor(self, num)
|
|
45
59
|
return num
|
|
46
60
|
end
|
|
47
|
-
--- Helper function to safely cast
|
|
61
|
+
--- Helper function to safely cast an `int` to a `PillEffect`. (This is better than using the `as`
|
|
48
62
|
-- TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
49
63
|
--
|
|
50
64
|
-- This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
51
65
|
function ____exports.asPillEffect(self, num)
|
|
52
66
|
return num
|
|
53
67
|
end
|
|
54
|
-
--- Helper function to safely cast
|
|
68
|
+
--- Helper function to safely cast an `int` to a `PlayerType`. (This is better than using the `as`
|
|
55
69
|
-- TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
56
70
|
--
|
|
57
71
|
-- This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
@@ -65,7 +79,7 @@ end
|
|
|
65
79
|
function ____exports.asString(self, str)
|
|
66
80
|
return str
|
|
67
81
|
end
|
|
68
|
-
--- Helper function to safely cast
|
|
82
|
+
--- Helper function to safely cast an `int` to a `TrinketType`. (This is better than using the `as`
|
|
69
83
|
-- TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
70
84
|
--
|
|
71
85
|
-- This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
package/package.json
CHANGED
package/src/functions/types.ts
CHANGED
|
@@ -10,42 +10,62 @@ import type {
|
|
|
10
10
|
} from "isaac-typescript-definitions";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* Helper function to safely cast
|
|
13
|
+
* Helper function to safely cast an `int` to a `CardType`. (This is better than using the `as`
|
|
14
14
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
15
15
|
*
|
|
16
16
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
17
17
|
*/
|
|
18
|
-
export function asCardType(num:
|
|
18
|
+
export function asCardType(num: int): CardType {
|
|
19
19
|
return num;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* Helper function to safely cast
|
|
23
|
+
* Helper function to safely cast an `int` to a `CollectibleType`. (This is better than using the
|
|
24
24
|
* `as` TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
25
25
|
*
|
|
26
26
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
27
27
|
*/
|
|
28
|
-
export function asCollectibleType(num:
|
|
28
|
+
export function asCollectibleType(num: int): CollectibleType {
|
|
29
29
|
return num;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* Helper function to safely cast
|
|
33
|
+
* Helper function to safely cast an enum to an `int`. (This is better than using the `as`
|
|
34
34
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
35
35
|
*
|
|
36
36
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
37
37
|
*/
|
|
38
|
-
export function
|
|
38
|
+
export function asFloat(num: number): float {
|
|
39
39
|
return num;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
* Helper function to safely cast
|
|
43
|
+
* Helper function to safely cast an enum to an `int`. (This is better than using the `as`
|
|
44
44
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
45
45
|
*
|
|
46
46
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
47
47
|
*/
|
|
48
|
-
export function
|
|
48
|
+
export function asInt(num: number): int {
|
|
49
|
+
return num;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Helper function to safely cast an `int` to a `LevelStage`. (This is better than using the `as`
|
|
54
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
55
|
+
*
|
|
56
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
57
|
+
*/
|
|
58
|
+
export function asLevelStage(num: int): LevelStage {
|
|
59
|
+
return num;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Helper function to safely cast an `int` to a `NPCState`. (This is better than using the `as`
|
|
64
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
65
|
+
*
|
|
66
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
67
|
+
*/
|
|
68
|
+
export function asNPCState(num: int): NPCState {
|
|
49
69
|
return num;
|
|
50
70
|
}
|
|
51
71
|
|
|
@@ -60,32 +80,32 @@ export function asNumber(num: number): number {
|
|
|
60
80
|
}
|
|
61
81
|
|
|
62
82
|
/**
|
|
63
|
-
* Helper function to safely cast
|
|
83
|
+
* Helper function to safely cast an `int` to a `PillColor`. (This is better than using the `as`
|
|
64
84
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
65
85
|
*
|
|
66
86
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
67
87
|
*/
|
|
68
|
-
export function asPillColor(num:
|
|
88
|
+
export function asPillColor(num: int): PillColor {
|
|
69
89
|
return num;
|
|
70
90
|
}
|
|
71
91
|
|
|
72
92
|
/**
|
|
73
|
-
* Helper function to safely cast
|
|
93
|
+
* Helper function to safely cast an `int` to a `PillEffect`. (This is better than using the `as`
|
|
74
94
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
75
95
|
*
|
|
76
96
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
77
97
|
*/
|
|
78
|
-
export function asPillEffect(num:
|
|
98
|
+
export function asPillEffect(num: int): PillEffect {
|
|
79
99
|
return num;
|
|
80
100
|
}
|
|
81
101
|
|
|
82
102
|
/**
|
|
83
|
-
* Helper function to safely cast
|
|
103
|
+
* Helper function to safely cast an `int` to a `PlayerType`. (This is better than using the `as`
|
|
84
104
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
85
105
|
*
|
|
86
106
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
87
107
|
*/
|
|
88
|
-
export function asPlayerType(num:
|
|
108
|
+
export function asPlayerType(num: int): PlayerType {
|
|
89
109
|
return num;
|
|
90
110
|
}
|
|
91
111
|
|
|
@@ -100,12 +120,12 @@ export function asString(str: string): string {
|
|
|
100
120
|
}
|
|
101
121
|
|
|
102
122
|
/**
|
|
103
|
-
* Helper function to safely cast
|
|
123
|
+
* Helper function to safely cast an `int` to a `TrinketType`. (This is better than using the `as`
|
|
104
124
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
105
125
|
*
|
|
106
126
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
107
127
|
*/
|
|
108
|
-
export function asTrinketType(num:
|
|
128
|
+
export function asTrinketType(num: int): TrinketType {
|
|
109
129
|
return num;
|
|
110
130
|
}
|
|
111
131
|
|