Oxform
Guide

TypeScript

Use inferred field names and values with Oxform.

TypeScript

Oxform infers the form values type from schema. defaultValues is checked against that type rather than supplying a separate type. Field paths and field values follow the inferred values type.

import { ,  } from '@oxform/react';
import {  } from 'zod';

const  = .({
  : .({
    : .(),
  }),
  : .(),
});

function () {
  const  = ({
    ,
    : {
      : {
        : '',
      },
      : false,
    },
  });

  const email = ({ , : 'account.email' });
const email: UseFieldReturn<string, "error">
const newsletter = ({ , : 'newsletter' });
const newsletter: UseFieldReturn<ObjectValue<never, {
    account: {
        email: string;
    };
    newsletter: boolean;
}, "newsletter">, "error">
return ( <> < {....} /> < ='checkbox' ={..} ={ => .(..)} /> </> ); }

Field names are checked at compile time. Invalid paths are rejected before they reach runtime.

Shared Options

formOptions preserves schema-derived value types and issue levels when sharing configuration. It returns the supplied options without creating a form or validating values.

import { , ,  } from '@oxform/react';
import type { , , ,  } from '@oxform/react';
import {  } from 'zod';

const  = .({ : .() });
const  = ({
  ,
  : { : '' },
  : { : { : { :  } } },
});

function () {
  const  = ();
  const  = ({ , : 'email' });

  type  = <typeof >;
  type  = <typeof >;
  type  = <typeof , 'email'>;
  type  = <typeof >;

  return < {....} />;
}

FormArrayFields<Form> selects array-valued paths. Array item paths can include undefined in their value type because an index may be absent. InferFormIssueLevels<Options> extracts checks keys and includes error; no configured keys infers error alone. The core package also exports DeepKeys, DeepValue, DeepKeysOfType, ArrayDeepKeys, and FieldsMap for value-level path typing.