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
Our goal is to build a custom component that accepts the message key as input and displays the various messages within a single component. While this works fine for single values (e.g., message: "hello"), we are unable to correctly pass the Record based message to a component.
Current Implementation:
Here is our current code, which does not have the correct type for the field value. Typically, you would use FormPathLeaves<T> directly, but that is not possible with Record. Additionally, the code has incorrect types for the $errors and $value stores, as it treats them as singular values.
Description:
We are using a Zod schema with
Record<string, string>
to support a multi-languagemessage
. Our schema is defined as follows:This allows inputs such as:
Our goal is to build a custom component that accepts the
message
key as input and displays the various messages within a single component. While this works fine for single values (e.g.,message: "hello"
), we are unable to correctly pass theRecord
based message to a component.Current Implementation:
Here is our current code, which does not have the correct type for the
field
value. Typically, you would useFormPathLeaves<T>
directly, but that is not possible withRecord
. Additionally, the code has incorrect types for the$errors
and$value
stores, as it treats them as singular values.Question:
What is the correct way to handle a
Record<string, string>
based input when using Superforms?Expected Behavior:
We need a solution that correctly types the
field
value and ensures the$errors
and$value
stores are correctly typed asRecord<string, string>
.Any guidance or examples on how to achieve this would be greatly appreciated. Thank you!
The text was updated successfully, but these errors were encountered: