I want to be able to validate that a value is one of several specific values and then get a union type returned
e.g.
ow.string.oneOf(["on", "off"] as const)
The type would be StringPredicate<"on" | "off">
rather than simply StringPredicate
or some subclass of Predicate<T>
.
A different solution that might work would be to use ow.any(…)
so that union types can be defined for more than just strings:
ow.any(ow.const("on" as const), ow.const("off" as const))
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too