effex-monorepo
    Preparing search index...

    Variable Form

    Form: {
        FormTypeId: symbol;
        isForm: (
            value: unknown,
        ) => value is Form<Record<string, Field<any, any>>, never, any>;
        make: <
            Fields extends Record<string, Field<any, any>>,
            E = never,
            R = never,
        >(
            fields: Fields,
            config?: FormConfig<
                { [K in string
                | number
                | symbol]: FieldEncodedOf<Fields[K]> },
                { [K in string | number | symbol]: FieldTypeOf<Fields[K]> },
                E,
                R,
            >,
        ) => Form<Fields, R>;
    }

    Type Declaration

    • FormTypeId: symbol
    • isForm: (value: unknown) => value is Form<Record<string, Field<any, any>>, never, any>

      Check if a value is a Form.

    • make: <Fields extends Record<string, Field<any, any>>, E = never, R = never>(
          fields: Fields,
          config?: FormConfig<
              { [K in string
              | number
              | symbol]: FieldEncodedOf<Fields[K]> },
              { [K in string | number | symbol]: FieldTypeOf<Fields[K]> },
              E,
              R,
          >,
      ) => Form<Fields, R>

      Create a new Form definition.

      const LoginForm = Form.make({
      email: Field.make(Schema.String.pipe(Schema.email()), { validateOn: 'blur' }),
      password: Field.make(Schema.String.pipe(Schema.minLength(8))),
      }, {
      validateOn: 'blur',
      onSubmit: (ctx) => telemetry.track("login_attempt"),
      });