DeclaredView.of
function · packages/mixins-form/src/declared.ts:130
of<
Form extends {
readonly Message: {
readonly Type: unknown
}
},
Key extends string,
Model,
>(
form: Form & {
readonly field: (model: Model, key: Key) => FieldValidation.Field<Draft>
},
declared: DeclaredForm<NoInfer<Key>, NoInfer<Model>>,
options?: DeclaredViewOptions<NoInfer<Key>, Form['Message']['Type']>,
): {
readonly form: Form
readonly options: {
readonly attrs: AttrsByKey<Key>
readonly renderers: Renderers<Form['Message']['Type']>
}
}A form and its declarations as FormView takes them: form is the form
read through declared.field, so a rule over several keys shows beside
its keys, and options holds each key's attrs and the renderers of
the declared kinds. Pass both on:
Example
ts
const stay = DeclaredView.of(StayForm, Declared.of(StayForm))
const fields = FormView.fields(stay.form, stay.options)