Closed ispyinternet closed 1 week ago
What does not work? It works for me. Take a look at this playground.
hmm, I'm using this in conjuction with superforms. Do you think there is anywhere this could cause the problem, otherwise I guess it must be user error.
Are you using the latest version of Valibot and Superforms?
It's a user error. I was expecting to be able to validate with the key 🤦♂️
Is there a pattern that would make this easy to do?
What is your use case? Have you read the enum guide?
tyring to use
_enum
with javascript objects. It seems to me that it is only possible to successfully validate your value if the object key value pairs are the same. E.G:
This object works:
export const role = { 'Admin': 'Admin', 'User': 'User' } as const;
but this one doesn't:
export const role = { 'ADMIN': 'Admin', 'USER': 'User' } as const;
Unless of course I am doing something wrong 🫤