Nullable + Refine (Not Recommended)
Output type still has null - requires ! assertions

Why this approach is not recommended:

  • Output type is string | null even after validation
  • Must use ! or type guards in onSubmit
  • Adding .transform() breaks zodResolver
  • No type safety benefit over just using null assertions

Better alternatives:

Mode: create

useWatch (typed as T | null naturally):

name: null

email: null

Address *

The problem in onSubmit:

function onSubmit(data) {
  // data.name is string | null
  // even though validation passed!
  const name = data.name!; // Need !
}