createPacker
createPacker<
TInput,TOutput,TFields>(fields,typeName):Packer<TInput,TOutput>
Creates a type-safe packer from field definitions.
Use as const on the fields array for compile-time field name validation.
Type Parameters
| Type Parameter | Default type |
|---|---|
TInput extends Record<string, unknown> | - |
TOutput extends Record<string, unknown> | - |
TFields extends readonly FieldInfo[] | readonly FieldInfo[] |
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
fields | TFields & ValidateFieldNames<TInput, TFields> | undefined | Field definitions from generated code. |
typeName | string | 'Packer' | Type name for debugging. |
Returns
Packer<TInput, TOutput>