Form work
Some checks failed
Lint / lint (push) Failing after 15s

This commit is contained in:
Julien Valverdé
2025-04-15 23:55:50 +02:00
parent 9436602443
commit ab0dce107d
2 changed files with 29 additions and 22 deletions

View File

@@ -0,0 +1,25 @@
import type { Schema } from "effect"
import type * as Form from "./Form.ts"
export interface FormField<S extends Schema.Schema.Any> {
}
export interface GenericFormField<S extends Schema.Schema.Any> extends FormField<S> {
readonly _tag: "GenericFormField"
readonly schema: S
readonly value: S["Type"]
}
export interface ArrayFormField<S extends Schema.Array$<Schema.Schema.Any>> extends FormField<S> {
readonly _tag: "ArrayFormField"
readonly schema: S
readonly elements: readonly Form.FormTree<S["value"]>[]
}
export interface StructFormField<S extends Schema.Struct<Schema.Struct.Fields>> extends FormField<S> {
readonly _tag: "StructFormField"
readonly schema: S
readonly fields: { [K in keyof S["fields"]]: Form.FormTree<S["fields"][K]> }
}