-
-
Notifications
You must be signed in to change notification settings - Fork 502
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
Add OneOrMore and NOrMore types #287
Conversation
539f76b
to
50e2985
Compare
index.d.ts
Outdated
@@ -28,6 +28,7 @@ export {ConditionalPick} from './source/conditional-pick'; | |||
export {UnionToIntersection} from './source/union-to-intersection'; | |||
export {Stringified} from './source/stringified'; | |||
export {FixedLengthArray} from './source/fixed-length-array'; | |||
export {OneOrMore, NOrMore} from './source/n-or-more'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The naming on the second one is a bit unfortunate. I keep reading it as no-r-more
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would AtLeastOne
and AtLeastN
be better names? Or maybe MoreThanN
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would AtLeastOne and AtLeastN be better names?
Yes
Or maybe MoreThanN?
This has a different meaning than NOrMore
. (>
vs >=
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about NonEmpty
?
It could be NonEmpty
and MinimumN
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like NonEmpty
and MinimumN
. See 446e3c5.
readme.md
Outdated
@@ -121,6 +121,8 @@ Click the type names for complete docs. | |||
- [`FixedLengthArray`](source/fixed-length-array.d.ts) - Create a type that represents an array of the given type and length. | |||
- [`MultidimensionalArray`](source/multidimensional-array.d.ts) - Create a type that represents a multidimensional array of the given type and dimensions. | |||
- [`MultidimensionalReadonlyArray`](source/multidimensional-readonly-array.d.ts) - Create a type that represents a multidimensional readonly array of the given type and dimensions. | |||
- [`OneOrMore`](source/n-or-more.d.ts) - Create a type of one or more items. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer using the word "elements" over "items", so we should use that consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 446e3c5
source/n-or-more.d.ts
Outdated
@@ -0,0 +1,31 @@ | |||
/** | |||
Create a type of one or more items. | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to mention use-cases and a usage example.
…s suggested in pull request review.
FYI: I updated this pull request based on feedback (and after being MIA for a bit). I still need to add use cases and a usage example. I will do this after #294 is finalized/merged. Because this draft should be updated to use the updated |
readme.md
Outdated
- [`NonEmpty`](source/minimum-n.d.ts) - Create a type of one or more elements. | ||
- [`MinimumN`](source/minimum-n.d.ts) - Create a type of N or more elements. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds like it's describing a union type, you should explicitly mention that this is an array type.
/** | ||
Create a type of one or more elements. | ||
|
||
@category Utilities |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@category Utilities | |
@category Array |
Categories were made more specific in #331
29f3df0
to
08de69b
Compare
Seeing as this is blocked by #284 and that issue is not going anywhere, what should we do about this pull request? |
Ah ok. That's good news. I can keep the PR open for a couple of months more. |
Closing for lack of activity. Moved this into two issues: |
Depends on #284 being fixed.
This is still a draft. You can see I inlined @jonahsnider's improved
FixedLengthArray
. (It does not work with existingFixedLengthArray
)