Repository: react-hook-form/react-hook-form
File: src/useForm.ts (TypeScript)

Code before:
        },
      });
      hasValidation(options, true) &&
        set(fieldsWithValidationRef.current, name, true);
      fieldsNamesRef.current.add(name);
      isInitialRegister && updateValidAndValue(name, options);

      return isWindowUndefined
        ? ({ name: name as InternalFieldName } as UseFormRegisterReturn)
        : {
            name,
            onChange: handleChange,
            onBlur: handleChange,
            ref: (ref: HTMLInputElement | null): void => {
              if (ref) {
                registerFieldRef(name, ref, options);
              } else {
                const field = get(fieldsRef.current, name) as Field;
                const shouldUnmount =
                  shouldUnregister || (options && options.shouldUnregister);
                if (field && field._f) {
                  field._f.mount = false;
                  // If initial state of field element is disabled,
                  // value is not set on first "register"
                  // re-sync the value in when it switched to enabled
                  if (!field._f.value && field._f.ref.value) {
                    field._f.value = field._f.ref.value;
                  }
                }

                if (
                  isWeb &&
                  (isNameInFieldArray(fieldArrayNamesRef.current, name)
                    ? shouldUnmount && !inFieldArrayActionRef.current
                    : shouldUnmount)
                ) {
                  unregisterFieldsNamesRef.current.add(name);
                }
              }
            },
          };
    },
    [defaultValuesRef.current],
  );

  const handleSubmit: UseFormHandleSubmit<TFieldValues> = React.useCallback(
    (onValid, onInvalid) => async (e) => {
      if (e) {
        e.preventDefault && e.preventDefault();
        e.persist && e.persist();
      }

Review comment (suggestion):
```suggestion
                  if (isUndefined(field._f.value) && isUndefined(field._f.ref.value)) {
```

I think check `undefined` is safer, in case of `boolean` value or negative number. 

Code after:
        },
      });
      hasValidation(options, true) &&
        set(fieldsWithValidationRef.current, name, true);
      fieldsNamesRef.current.add(name);
      isInitialRegister && updateValidAndValue(name, options);

      return isWindowUndefined
        ? ({ name: name as InternalFieldName } as UseFormRegisterReturn)
        : {
            name,
            onChange: handleChange,
            onBlur: handleChange,
            ref: (ref: HTMLInputElement | null): void => {
              if (ref) {
                registerFieldRef(name, ref, options);
              } else {
                const field = get(fieldsRef.current, name) as Field;
                const shouldUnmount =
                  shouldUnregister || (options && options.shouldUnregister);
                if (field && field._f) {
                  field._f.mount = false;
                  // If initial state of field element is disabled,
                  // value is not set on first "register"
                  // re-sync the value in when it switched to enabled
                  if (
                    isUndefined(field._f.value) &&
                    !isUndefined(field._f.ref.value)
                  ) {
                    field._f.value = field._f.ref.value;
                  }
                }

                if (
                  isWeb &&
                  (isNameInFieldArray(fieldArrayNamesRef.current, name)
                    ? shouldUnmount && !inFieldArrayActionRef.current
                    : shouldUnmount)
                ) {
                  unregisterFieldsNamesRef.current.add(name);
                }
              }
            },
          };
    },
    [defaultValuesRef.current],
  );

  const handleSubmit: UseFormHandleSubmit<TFieldValues> = React.useCallback(
    (onValid, onInvalid) => async (e) => {
      if (e) {