Skip to content
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

IntRange Inclusive #803

Open
BrendanC23 opened this issue Jan 23, 2024 · 3 comments
Open

IntRange Inclusive #803

BrendanC23 opened this issue Jan 23, 2024 · 3 comments
Labels
help wanted Extra attention is needed type addition

Comments

@BrendanC23
Copy link

BrendanC23 commented Jan 23, 2024

The IntRange type was added in this PR. As mentioned in the documentation The numbers are created from the given Start(inclusive) parameter to the givenEnd (exclusive) parameter..

Could an option be added to this type that would allow the end parameter to be inclusive? For example,

IntRangeInclusive<0, 3> = 0 | 1 | 2 | 3

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • The funding will be given to active contributors.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@sindresorhus
Copy link
Owner

Yeah, we should add a inclusive range method too.

Alternative name: IntClosedRange

@sindresorhus sindresorhus added help wanted Extra attention is needed type addition labels Jan 23, 2024
@lucasteles
Copy link
Contributor

Yes please, would be easy to define it

type IntClosedRange<Start extends number, End extends number> = IntRange<Start, End> | End

@Emiyaaaaa
Copy link
Collaborator

Emiyaaaaa commented Jan 29, 2024

Yes please, would be easy to define it

type IntClosedRange<Start extends number, End extends number> = IntRange<Start, End> | End

I think it should be

type IntClosedRange<Start extends number, End extends number, Skip extends number> = IntRange<Start, Add<End, 1>, Skip>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed type addition
Projects
None yet
Development

No branches or pull requests

4 participants