defineForm()
An identity function whose argument type extends the Form
type. This function is used for type checking.
typescript
function defineForm<T extends Form>(form: T): T {
return form;
}
Details of Form
type
An object that satisfies the following:
- Key
- Starting with
$
are not available.
- Starting with
- Value is one of the following
Field
object (field()
returns)PrivateField
object (privateField()
returns)FormsField
object (formsField()
returns)- A Function
Form
object recursively
typescript
type Form = {
[key: `$${string}`]: never;
[key: string]:
| Field<any>
| PrivateField<any>
| FormsField<(arg: any) => Form>
| ((...args: any[]) => any)
| Form;
};