type-fest
type-fest copied to clipboard
SingleOrArray - Add type for a single value or an array of values
Fairly straightforward type but quite useful. It's often that APIs will have a function that accepts string | string[]
or similarly string | FooType | string[] | FooType[]
. It would be nice to express these instead as SingleOrArray<string>
or SingleOrArray<string | FooType>
.
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.