node-multi-integer-range
node-multi-integer-range copied to clipboard
BigInt support
Steps
- [ ] Allow raw bigint values as input (
new MultiRange([[555n, 999n]])
) - [ ] Add an option to parse strings as bigint
new MultiRange('999999999999999999', { bigInt: true }); // Should throw RangeError without bigInt option
- [ ] Update type definitions after TypeScript officially supports BigInt
We will not do automatic type conversions to/from plain numbers. You should use use either number
or bigint
exclusively within a single instance of MultiRange.
- TC39 BigInt proposal (now stage 3): https://github.com/tc39/proposal-bigint
- TypeScript issue: https://github.com/Microsoft/TypeScript/issues/15096
I will wait until TypeScript supports BigInt (planned in August 2018 according to the latest roadmap).
Any updates on that?
@1valdis Oh, thank you for the interest in this feature :) I started investigating this seriously, and found that there is no way to use Infinity
as a literal type in TypeScript... For now, it's difficult to use unbounded ranges along with bigint. Is this limitation important to you?
@smikitky I believe it'll be enough to have bounded ranges for now. How about making just a bounded version, and adding unbounded later (if even)? Throw if trying to use an unbounded initializer with bigint option?
Offtopic Nice library you have there. I wonder why so few users. It's just ideally what I needed for my lazy rendering of audio frequency graph using Web Audio api. I believe there are much more use cases...
@1valdis Thank you. It turned out that this is painful to implement without the literal Infinity
type, so I created an issue in the TypeScript project. Let's see what happens...
@smikitky Any chance this still on the roadmap?
@jkchuynh829 I'm still waitng for this issue to be resolved.