Closed as not planned
Closed as not planned
Description
In tc39/proposal-slice-notation#19 (comment) I suggested adding something similar to the C# Index
and Range
types which could also address these use cases with a more flexible API than an overloaded Number.range
method.
An example of these APIs can be found here:
Index
- https://github.com/esfx/esfx/blob/c50876e542bc73df907b5e3ff4ef95ad656cb3b3/packages/interval/src/index.ts#L23Interval
- https://github.com/esfx/esfx/blob/c50876e542bc73df907b5e3ff4ef95ad656cb3b3/packages/interval/src/index.ts#L107
The advantage of this (or a similar) API is that it provides a convenient place to attach functionality like .includes(value)
, as well as a place to provide different ways to generate an Interval
without relying on possibly confusing overloaded behavior like Number.range(10)
.
Metadata
Metadata
Assignees
Labels
No labels