You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But what I would assume to be the equivalent code in Valibot doesn't appear to be valid
constlocalesSchema=union([literal(`en-US`),literal(`en-GB`),literal(`es-ES`),literal(`de`),literal(`fr`),literal(`it`),literal(`zh-CN`)])constnameLocalizationsSchema=record(localesSchema,// Error, not assignable to RecordKeystring([minLength(1),maxLength(100)]))
While you could argue that an enum is a better fit here than a union, it's still perfectly valid Typescript to use a string union as a Record key type. Would appreciate it if Valibot could support this!
The text was updated successfully, but these errors were encountered:
Thanks that seems to work for now! Of course I'm reading through the source code to try and work out the API and usage information for all the functions so it wasn't clear how to do this migration.
Trying to port some code from Zod and noticed this pattern doesn't appear to translate as easily as I'd like.
But what I would assume to be the equivalent code in Valibot doesn't appear to be valid
While you could argue that an enum is a better fit here than a union, it's still perfectly valid Typescript to use a string union as a Record key type. Would appreciate it if Valibot could support this!
The text was updated successfully, but these errors were encountered: