type-fest icon indicating copy to clipboard operation
type-fest copied to clipboard

SingleOrArray - Add type for a single value or an array of values

Open Michael-Ziluck opened this issue 1 year ago • 0 comments

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.
Fund with Polar

Michael-Ziluck avatar Aug 23 '23 15:08 Michael-Ziluck