Closed ShlokDesai33 closed 2 weeks ago
Maybe Record<typeof purchaseForm[keyof typeof purchaseForm]['id'], ReturnType<typeof getEntrySchema>>
but I need the entire code to be able to debug it. You can also have a look at this function with similar code.
This is the schema I'm trying to create:
Here, the purchase form has field names that I cannot know ahead of time (they are randomly generated ids). However, I know the schema of a field depending on it's type (
curr.type
). Therefore,getEntrySchema
returns a valibot object schema using thetype
ofcurr
.Typescript is throwing the following error:
How can I fix this? Any help is greatly appreciated!