This type uses conditional types to enforce the following constraints at compile-time:
Headerless Mode (header: []):
outputFormat: 'array'columnCountStrategy: 'keep' (or omit for default)Normal Mode (header inferred or explicit):
header: undefined → infer from first rowheader: ['col1', ...] → explicit headeroutputFormat and columnCountStrategy// ✓ Valid: headerless with array format
const opts1: CSVRecordAssemblerOptions<readonly []> = {
header: [],
outputFormat: 'array',
columnCountStrategy: 'keep'
};
// ✗ Type error: headerless requires array format
const opts2: CSVRecordAssemblerOptions<readonly []> = {
header: [],
outputFormat: 'object' // Error!
};
// ✗ Type error: headerless only allows 'keep' strategy
const opts3: CSVRecordAssemblerOptions<readonly []> = {
header: [],
outputFormat: 'array',
columnCountStrategy: 'strict' // Error!
};
CSV Record Assembler Options with type-level constraints.