Closed decoursin closed 1 month ago
Zod supports these fixed set enums which are like arrays declared with the const keyword. I was hoping Effect's Schema could also.
const
Schema
Support for const arrays.
I have tried Schema.Enums which doesn't work.
Schema.Enums
I believe you want
Schema.Literal("a", "b") // or Schema.Literal(...arr)
@jessekelly881 Thanks. The Schema.Literal(...arr) works. Sorry for the inconvenience. I suppose an example might be good, but IDK up to you!
Schema.Literal(...arr)
What is the problem this feature would solve?
Zod supports these fixed set enums which are like arrays declared with the
const
keyword. I was hoping Effect'sSchema
could also.What is the feature you are proposing to solve the problem?
Support for const arrays.
What alternatives have you considered?
I have tried
Schema.Enums
which doesn't work.