-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: expose fieldset metadata #781
base: main
Are you sure you want to change the base?
chore: expose fieldset metadata #781
Conversation
|
More templates
@conform-to/dom
@conform-to/react
@conform-to/validitystate
@conform-to/yup
@conform-to/zod
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Can you help adding a changeset? I think this should be considered a feature.
export type FieldsetMetadata< | ||
Schema extends Record<string, unknown> = Record<string, unknown>, | ||
FormError = string[], | ||
> = Required<{ | ||
[Key in keyof Combine<Schema>]: FieldMetadata< | ||
Combine<Schema>[Key], | ||
Schema, | ||
FormError | ||
>; | ||
}>; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should reuse this for the return type of getFieldset()
on SubfieldMetadata
well. Meaning Schema
and FormSchema
could be different. Maybe something like this?
export type FieldsetMetadata<
Schema extends Record<string, unknown> = Record<string, unknown>,
FormSchema extends Record<string, any> = Schema,
FormError = string[],
> = Required<{
[Key in keyof Combine<Schema>]: FieldMetadata<
Combine<Schema>[Key],
FormSchema,
FormError
>;
}>;
This PR exposes a
FieldsetMetadata
type so that people who use thereact
package don't need to drop into@conform-to/dom
to get theCombine
type to reconstruct this type.