title: How to correctly validate and submit if form is valid with ant design form with typescript
body: <p>I build a simple form with react, redux, typescript ant design. 
  Following the ant design documentation, I created a small form using the provided  <code>getFieldDecorator</code> and <code>Form.create</code>methods. Everything works fine so far and validation is handled by ant design itself when entering data into the fields.
  My main issue is with the form submit. I want to submit data only if the form is validated and the form is, therefore "valid". </p>
  
  <p>The official documentation uses <code>validateFields</code> to validate the form and returns a variable which contains the errors and returns further execution so that the form doesn't get submitted.
  Now with typescript I have the following signatures:
  <code>validateFields(): void;</code> &lt;- I use this method to trigger validation upon submit of the form and afterwards call <code>getFieldsError(names?: Array&lt;string&gt;): Record&lt;string, string[] | undefined&gt;;</code></p>
  
  <p>Now if you look at the example code, the ugly part is using a variable "allValid" to check if the form is valid or not. I thought there must be a simpler way of validating and submitting data if the form is valid.</p>
  
  <pre class="lang-js prettyprint-override"><code>const UploadForm: FunctionComponent&lt;FormComponentProps&gt; = props =&gt; {
    const { getFieldDecorator, validateFields, getFieldsError } = props.form;
    const dispatch = useDispatch();
  
    return (
      &lt;Form
        {...formItemLayout}
        onSubmit={event =&gt; {
          event.preventDefault();
          validateFields();
          const validationErrors = getFieldsError();
          let allValid = true;
          console.log(validationErrors);
          for (let key in validationErrors) {
            console.log(validationErrors[key]);
            if (validationErrors[key] !== undefined) {
              allValid = false;
              break;
            }
          }
  
          if (allValid) {
            dispatch(submitFormData());
          }
        }}
      &gt;
        &lt;ImageComponent /&gt;
        &lt;Form.Item label="E-mail"&gt;
          {getFieldDecorator("email", {
            rules: [
              {
                type: "email",
                message: "The input is not valid E-mail!"
              },
              {
                required: true,
                message: "Please enter your E-mail!"
              }
            ]
          })(
            &lt;Input
              prefix={&lt;Icon type="mail" style={{ color: "rgba(0,0,0,.25)" }} /&gt;}
              placeholder="Your e-mail"
            /&gt;
          )}
        &lt;/Form.Item&gt;
        &lt;Form.Item {...buttonItemLayout}&gt;
          &lt;Button type="primary" htmlType="submit"&gt;
            Submit
          &lt;/Button&gt;
        &lt;/Form.Item&gt;
      &lt;/Form&gt;
    );
  };
  
  export default Form.create &lt; FormComponentProps &gt; {}(UploadForm);
  
  </code></pre>