web-csv-toolbox - v0.14.0
    Preparing search index...

    Type Alias CSVRecordAssemblerOptions<Header>

    CSVRecordAssemblerOptions: Header extends readonly []
        ? CSVRecordAssemblerBaseOptions & {
            columnCountStrategy?: "keep";
            header: readonly [];
            includeHeader?: boolean;
            outputFormat: "array";
        }
        : CSVRecordAssemblerBaseOptions & {
            columnCountStrategy?: ColumnCountStrategy;
            header?: Header;
            includeHeader?: boolean;
            outputFormat?: "object"
            | "array";
        }

    CSV Record Assembler Options with type-level constraints.

    Type Parameters

    • Header extends ReadonlyArray<string>

    This type uses conditional types to enforce the following constraints at compile-time:

    Headerless Mode (header: []):

    • Requires outputFormat: 'array'
    • Only allows columnCountStrategy: 'keep' (or omit for default)
    • All rows are treated as data (no header inference)

    Normal Mode (header inferred or explicit):

    • header: undefined → infer from first row
    • header: ['col1', ...] → explicit header
    • Allows any outputFormat 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!
    };