Types
All types listed below are exported from the core entry:
import type {
AbstractSchema,
ApiErrorDetails,
ApiErrorEnvelope,
ArrayItem,
ArrayPath,
CoercionEntry,
CoercionRegistry,
CoercionResult,
CurrentValueContext,
CurrentValueWithContext,
CustomDirectiveRegisterAssignerFn,
DeepPartial,
DefaultValuesResponse,
DefaultValuesShape,
FieldState,
FieldStateLeaf,
FieldStateMap,
FieldStateMapEntry,
FlatPath,
FormErrorRecord,
FormErrorsSurface,
FormKey,
FormMeta,
FormStorage,
FormStorageKind,
GenericForm,
HandleSubmit,
HistoryConfig,
IsTuple,
MetaTrackerValue,
NestedReadType,
NestedType,
OnError,
OnInvalidSubmitPolicy,
OnSubmit,
ParseApiErrorsOptions,
ParseApiErrorsResult,
PendingValidationStatus,
PersistConfig,
PersistConfigOptions,
PersistIncludeMode,
ReactiveValidationStatus,
RegisterDirective,
RegisterFlatPath,
RegisterTransform,
RegisterValue,
SetValueCallback,
SetValuePayload,
SettledValidationStatus,
SlimPrimitiveKind,
SubmitHandler,
Unset,
UseFormReturnType,
UseFormConfiguration,
ValidateOn,
ValidateOnConfig,
ValidationError,
ValidationResponse,
ValidationResponseWithoutValue,
WriteShape,
} from 'attaform'
The ones you'll touch most:
FlatPath<Form>— union of every addressable path for the form. Dotted strings.NestedType<Form, Path>— the strict leaf type atPath. Used for write-side APIs (setValuevalue argument) and for the path-form callback'sprev(the runtime auto-defaults the slot before invoking the callback).NestedReadType<Form, Path>— the read-side leaf type. Walks the path tracking whether a numeric segment was crossed; once tainted, all subsequent results areT | undefined. Tuple positions stay strict. Composed withWriteShape<...>(see below) at the call site forregister,values,fields, andtoRef.WriteShape<T>— recursive mapped type that widens primitive- literal leaves to their primitive supertype.'red' | 'green'→string;42→number; nested objects recurse; tuples preserve positions; unbounded arrays widen elements;Date,RegExp,Map,Set, and functions pass through unchanged. Applied to read surfaces that observe storage (form.values,form.fields.<path>.value,register.innerRef). NOT applied tohandleSubmitorvalidate*()payloads — those run after validation, so the strict zod-inferred shape is honest there.DefaultValuesShape<T>—WriteShape<T>plus theunsetsentinel admitted at every primitive leaf (string,number,boolean,bigint). Applied to the write surfaces that accept intent (defaultValues,setValue's value,reset's argument, field-array helpers). Non-primitive leaves (Date,RegExp, etc.) stay strict —defaultValues: { joinedAt: unset }againstz.date()is a type error.Unset— the brand-typedunique symbolflavor of theunsetsentinel for type-level usage. The runtime symbol is exported alongside under the same name fromattaform.IsTuple<T>—truefor tuples (literallength),falsefor unbounded arrays (length: number). Used internally byNestedReadTypeto decide whether to taint past a numeric segment.SetValuePayload<Write, Read = Write>— union ofWriteandSetValueCallback<Read>. The whole-formsetValueparameterises both toWriteShape<Form>(prevmatchesform.values); the path-form parameterisesReadtoNonNullable<NestedType<F, P>>.SetValueCallback<Read>—(prev: Read) => Read. The callback's return shape matches its input shape; runtime mergeStructural completes any structural gaps.ArrayPath<Form>—FlatPath<Form>filtered to array-leaf paths. Used byappend/remove/ etc.ArrayItem<Form, Path>— the element type of the array atPath.ValidationError—{ path: readonly Segment[]; message: string; formKey: FormKey }.FieldStateLeaf<Value>— runtime shape of a singleform.fields.<path>read:value/original(typedValue),pristine/dirty/blank(booleans),focused/blurred/touched(boolean | null),errors(readonly ValidationError[]),path,isConnected,updatedAt. Schema fields with names matching these leaf keys at depth ≥ 2 are shadowed by the leaf — bracket-access viatoRefis the workaround.FieldStateMap<Form>— the recursive type behindform.fields. Top-level fields and nested objects are reachable via dot-descent; leaf keys (value,dirty,errors, …) read off the FieldStateLeaf at the current path.FieldState<Value = unknown>— richer per-field type kept for type-level utility code:currentValue/originalValue/previousValue(typedValue), the same flag set asFieldStateLeaf, plusmeta(MetaTrackerValue). Returned by no current public API directly; useful when type-narrowing or building higher-order helpers.ValidateOn—'change' | 'blur' | 'submit'. The trigger for per-field validation. Default'change'.'submit'opts out of live validation entirely (submit is the only validator).ValidateOnConfig— discriminated union overvalidateOnthat enforcesdebounceMsis only valid with'change'. The publicuseFormsignature intersectsUseFormConfigurationwith this so pairingdebounceMswith'blur'/'submit'is a TS error rather than a silent runtime drop.RegisterTransform—(value: unknown) => unknown. Element ofregister(path, { transforms: [...] }). Generic-erased so a personal library of transforms plugs into any path. See Transforms.CoercionEntry<I, O>—{ input: I; output: O; transform: (value) => CoercionResult<O> }whereI,OextendSlimPrimitiveKind. One coercion rule. Author withdefineCoercion(...)for narrowedtransformparameter typing.CoercionRegistry—readonly CoercionEntry[]. The shape consumed byuseForm({ coerce })anddefaults.coerce. SpreaddefaultCoercionRulesto extend rather than replace.CoercionResult<O>—{ coerced: true; value: O } | { coerced: false }. Returned by aCoercionEntry.transform. Returning{ coerced: false }signals "this rule doesn't apply" — the write passes through untouched.FormMeta— the shape ofform.meta: form-level flags (isDirty,isValid,isSubmitting,isValidating), counters (submitCount,historySize), the flaterrorsaggregate, and the per-mountinstanceId.FormErrorsSurface<F>— the shape ofform.errors. Drillable callable Proxy; per-leafValidationError[] | undefined. Replaces the pre-0.14 flat-record shapePartial<Record<FlatPath<F>, ValidationError[]>>.AbstractSchema— the schema contract (6 methods:fingerprint,getDefaultValues,getDefaultAtPath,getSchemasAtPath,validateAtPath,getSlimPrimitiveTypesAtPath). See custom-adapter recipe.SlimPrimitiveKind— the set of primitivetypeof-style kinds the slim-write contract recognises:'string','number','boolean','bigint','date','null','undefined','object','array','symbol','function','map','set'. Returned byAbstractSchema.getSlimPrimitiveTypesAtPath(path).MetaTrackerValue— per-leaf metadata:updatedAt,rawValue,isConnected,formKey,path. Read fromFieldState.metawhen type-narrowing through that surface.RegisterDirective— the union of everyv-registerdirective variant (text input, select, checkbox, radio, dynamic). Most consumers use this only when augmenting Vue'sGlobalDirectivesmanually; the Nuxt module wires it automatically.CustomDirectiveRegisterAssignerFn— function shape for custom assigners installed via the exportedassignKeysymbol.RegisterFlatPath<Form>— the path-constraint type used byregister(path). Consumers wrappingregisterin higher-order helpers can re-use it to type their wrapper's path parameter.FormStorage— the storage contract (4 methods:getItem,setItem,removeItem,listKeys). See persistence recipe.