```ts
/**
 * Splits one line of CSV into its fields on commas.
 * Handles quoted fields with doubled quotes inside.
 * Throws an Error if a quoted field is never closed.
 */
export function parseCsvLine(line: string): string[] {
    const result: string[] = [];
    let field = '';
    let inQuote = false;

    for (let i = 0; i < line.length; i++) {
        const char = line[i];

        if (char === '"') {
            if (!inQuote) {
                // Start of a quoted field
                inQuote = true;
            } else {
                // Check for doubled quote inside a quoted field
                if (i + 1 < line.length && line[i + 1] === '"') {
                    i++; // Skip the next character as it's part of the field
                    field += char; // Add the literal quote to the field
                } else {
                    // End of the quoted field
                    inQuote = false;
                    result.push(field.trim());
                    field = '';
                }
            }
        } else if (char === ',' && !inQuote) {
            // Field delimiter outside a quoted field
            result.push(field.trim());
            field = '';
        } else {
            // Add character to the current field
            field += char;
        }
    }

    if (inQuote) {
        throw new Error('Unquoted double-quote found');
    }

    if (field !== '') {
        result.push(field.trim());
    }

    return result;
}
```