Skip to content

Non-positive-integer enum value bug fixes

Compare
Choose a tag to compare
@UselessPickles UselessPickles released this 25 Apr 02:25
· 23 commits to master since this release

This is a bug fix for numeric enums whose values are not all positive integers.

The code that gets all of the keys of an enum (ignoring the reverse lookup keys that typescript automatically adds) incorrectly assumed that all numeric enum values (and therefore the reverse lookup keys) would be limited valid array index values (basically, non-negative integers within the range of a signed 32-bit value).

This was a bad assumption. Numeric enums can contain any numeric values, including floating point and negative values. The end result was widespread bugs if you had a numeric enum values that was negative or not an integer.