It would be good to have a Runtype for Enum that could take an existing TypeScript enum and return a type for validating it.
It would also be possible to optimise unions of literals by generating a Set<string | number> up front to allow O(log(n)) lookup instead of linearly traversing the list. It might also be worth adding some form of caching to show.
It would be good to have a Runtype for
Enum
that could take an existing TypeScript enum and return a type for validating it.It would also be possible to optimise unions of literals by generating a
Set<string | number>
up front to allowO(log(n))
lookup instead of linearly traversing the list. It might also be worth adding some form of caching toshow
.