Oxform
Guides

TypeScript

Infer values, field paths, array items, and issue levels.

TypeScript

createForm infers values from its Standard Schema validator and checks defaultValues against them. Field names select schema-derived paths; field writes and array items must match the selected value type.

Solid 2 preserves this inference. Import Oxform types from @oxform/solid/v2, import JSX from @solidjs/web, and set jsxImportSource to @solidjs/web. Follow the Solid 2 setup before using these examples with that entry.

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

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

function () {
  const  = ();
  const  = ({ , : 'profile.email' });
  const  = ({ , : 'contacts' });
  .({ : 'ada@example.com' });

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

  return < ='Email' {....} />;
}

formOptions preserves value and issue-level inference when sharing configuration; it returns the supplied options without creating state. Concrete checks keys infer a union such as 'error' | 'warning'. Broadly typed checks can widen the union to string.

FormArrayFields<Form> selects array-valued paths. Dynamic array item paths such as contacts.${number}.email can infer string | undefined because an index may be absent. Keep accessor paths literal with as const when needed:

const email = createField(() => ({ form, name: `contacts.${index()}.email` as const }));

Public Types

The adapter exports CreateFormReturn<Values, Checks>, CreateFieldReturn<Value, Level>, CreateArrayFieldReturn<Value, Level>, FieldInputProps<Value>, FieldProps<Form, Name>, ArrayFieldProps<Form, Name>, SubscribeProps<Api, Selected>, and MaybeAccessor<T>.

It also re-exports the core contracts exposed by the React package, including form options, store and status types, issues, reset options, path inference, and selector types. Core class constructors are runtime imports from @oxform/core.