Skip to content
On this page

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.
  • Value is one of the following
typescript
type Form = {
  [key: `$${string}`]: never;
  [key: string]:
    | Field<any>
    | PrivateField<any>
    | FormsField<(arg: any) => Form>
    | ((...args: any[]) => any)
    | Form;
};