isaacscript-common 48.0.0 → 49.0.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.
@@ -5427,13 +5427,14 @@ export declare function getEntityPositions(entities?: Entity[]): Map<PtrHash, Ve
5427
5427
  export declare function getEntityVelocities(entities?: Entity[]): Map<PtrHash, Vector>;
5428
5428
 
5429
5429
  /**
5430
- * TypeScriptToLua will transpile TypeScript enums to Lua tables that have a double mapping. Thus,
5431
- * when you iterate over them, you will get both the names of the enums and the values of the enums,
5432
- * in a random order. Use this helper function to get the entries of the enum with the reverse
5433
- * mappings filtered out.
5430
+ * TypeScriptToLua will transpile TypeScript number enums to Lua tables that have a double mapping.
5431
+ * Thus, when you iterate over them, you will get both the names of the enums and the values of the
5432
+ * enums, in a random order. Use this helper function to get the entries of the enum with the
5433
+ * reverse mappings filtered out.
5434
5434
  *
5435
5435
  * This function will return the enum values in a sorted order, which may not necessarily be the
5436
- * same order as which they were declared in.
5436
+ * same order as which they were declared in. (It is impossible to get the declaration order at
5437
+ * run-time.)
5437
5438
  *
5438
5439
  * This function will work properly for both number enums and string enums. (Reverse mappings are
5439
5440
  * not created for string enums.)
@@ -5446,12 +5447,13 @@ export declare function getEntityVelocities(entities?: Entity[]): Map<PtrHash, V
5446
5447
  export declare function getEnumEntries<T>(transpiledEnum: T): Array<[key: string, value: T[keyof T]]>;
5447
5448
 
5448
5449
  /**
5449
- * TypeScriptToLua will transpile TypeScript enums to Lua tables that have a double mapping. Thus,
5450
- * when you iterate over them, you will get both the names of the enums and the values of the enums,
5451
- * in a random order. If all you need are the keys of an enum, use this helper function.
5450
+ * TypeScriptToLua will transpile TypeScript number enums to Lua tables that have a double mapping.
5451
+ * Thus, when you iterate over them, you will get both the names of the enums and the values of the
5452
+ * enums, in a random order. If all you need are the keys of an enum, use this helper function.
5452
5453
  *
5453
5454
  * This function will return the enum keys in a sorted order, which may not necessarily be the same
5454
- * order as which they were declared in.
5455
+ * order as which they were declared in. (It is impossible to get the declaration order at
5456
+ * run-time.)
5455
5457
  *
5456
5458
  * This function will work properly for both number enums and string enums. (Reverse mappings are
5457
5459
  * not created for string enums.)
@@ -5467,12 +5469,32 @@ export declare function getEnumKeys(transpiledEnum: Record<string | number, stri
5467
5469
  export declare function getEnumLength(transpiledEnum: Record<string | number, string | number>): int;
5468
5470
 
5469
5471
  /**
5470
- * TypeScriptToLua will transpile TypeScript enums to Lua tables that have a double mapping. Thus,
5471
- * when you iterate over them, you will get both the names of the enums and the values of the enums,
5472
- * in a random order. If all you need are the values of an enum, use this helper function.
5472
+ * TypeScriptToLua will transpile TypeScript number enums to Lua tables that have a double mapping.
5473
+ * Thus, when you iterate over them, you will get both the names of the enums and the values of the
5474
+ * enums, in a random order. If all you need are the names of an enum from the reverse mapping, use
5475
+ * this helper function.
5476
+ *
5477
+ * This function will return the enum names in a sorted order, which may not necessarily be the same
5478
+ * order as which they were declared in. (It is impossible to get the declaration order at
5479
+ * run-time.)
5480
+ *
5481
+ * This function will work properly for both number enums and string enums. (Reverse mappings are
5482
+ * not created for string enums, so their names would be equivalent to what would be returned by the
5483
+ * `getEnumKeys` function.)
5484
+ *
5485
+ * For a more in depth explanation, see:
5486
+ * https://isaacscript.github.io/main/gotchas#iterating-over-enums
5487
+ */
5488
+ export declare function getEnumNames(transpiledEnum: Record<string | number, string | number>): string[];
5489
+
5490
+ /**
5491
+ * TypeScriptToLua will transpile TypeScript number enums to Lua tables that have a double mapping.
5492
+ * Thus, when you iterate over them, you will get both the names of the enums and the values of the
5493
+ * enums, in a random order. If all you need are the values of an enum, use this helper function.
5473
5494
  *
5474
5495
  * This function will return the enum values in a sorted order, which may not necessarily be the
5475
- * same order as which they were declared in.
5496
+ * same order as which they were declared in. (It is impossible to get the declaration order at
5497
+ * run-time.)
5476
5498
  *
5477
5499
  * This function will work properly for both number enums and string enums. (Reverse mappings are
5478
5500
  * not created for string enums.)
@@ -17804,7 +17826,7 @@ export declare function useCardTemp(player: EntityPlayer, cardType: CardType): v
17804
17826
  export declare function validateCustomEnum(transpiledEnumName: string, transpiledEnum: unknown): void;
17805
17827
 
17806
17828
  /**
17807
- * Helper function to validate if every value in an enum is contiguous, starting at 0.
17829
+ * Helper function to validate if every value in a number enum is contiguous, starting at 0.
17808
17830
  *
17809
17831
  * This is useful to automate checking large enums for typos.
17810
17832
  */