-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow bigint as an index type because number is allowed too #46395
Comments
This is IMO a pretty reasonable suggestion that would smooth out some use cases, like going from reasonable bit masks that fit within the safe range of the number type to very large bitmasks that require bigints to work, without any drawbacks (that I can think of anyway). |
Maybe a somewhat compelling use case: I have like hundreds of errors because bigints are not treated like numbers in records here: https://github.com/fabiospampinato/shosho/blob/7d688cf74a1a44aca7454c54902a606974f86053/src/maps.ts#L300-L817 Wrapping all of that in |
The fact that #19139 isn't available either makes this extra frustrating. |
👀 Microsoft deleted a comment from me 15 hrs ago - I wasnt even aware I commented this issue ever. What's going on? Anyone happen to have a screencap for me to investigate? Got no suspicious activity according to the GH settings page nor idle sessions etc. |
Your comment was simply noting what year it is. We expect comments to meaningfully contribute to the discussion and will clean up comments that don't do that. See also |
Huh... oh well.. I guess that's reasonable for deletion. And here I was fearing the worst, some spamlinks or similar. Thanks for clarification! |
3 years have passed and no advances? I got hundreds of errors due to this. Just why can't bigint be used as index type but number can? It causes no issues in JS. |
Suggestion
The bigint type currently is not allowed as an index type requiring an explicit string cast.
In JS, it's automatically cast as a string. This is what happens with numbers too. If numbers are automatically cast to strings, then why not allow bigint to be indexable as well? It would avoid having to explicitly cast all the time when it's not necessary in JS.
🔍 Search Terms
bigint index
✅ Viability Checklist
My suggestion meets these guidelines:
⭐ Suggestion
Just make bigint indexable.
📃 Motivating Example
The text was updated successfully, but these errors were encountered: