node-multi-integer-range icon indicating copy to clipboard operation
node-multi-integer-range copied to clipboard

BigInt support

Open smikitky opened this issue 6 years ago • 7 comments

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

smikitky avatar Jul 10 '18 09:07 smikitky

I will wait until TypeScript supports BigInt (planned in August 2018 according to the latest roadmap).

smikitky avatar Jul 10 '18 10:07 smikitky

Any updates on that?

1valdis avatar Jul 05 '19 13:07 1valdis

@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 avatar Jul 06 '19 14:07 smikitky

@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 avatar Jul 06 '19 15:07 1valdis

@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 avatar Jul 07 '19 08:07 smikitky

@smikitky Any chance this still on the roadmap?

jkchuynh829 avatar Mar 02 '22 07:03 jkchuynh829

@jkchuynh829 I'm still waitng for this issue to be resolved.

smikitky avatar Mar 02 '22 07:03 smikitky