```ts
/**
 * Parses a single line of CSV into its fields on commas.
 * Handles quoted fields that may contain commas and doubled quotes inside.
 * Throws an Error for a quoted field that is never closed.
 *
 * @param line - The line of CSV to parse.
 * @returns An array of fields.
 */
export function parseCsvLine(line: string): string[] {
  const result: string[] = [];
  let field = '';
  let inQuotes = false;

  for (let i = 0; i < line.length; i++) {
    if (line[i] === '"') {
      if (inQuotes && i + 1 < line.length && line[i + 1] === '"') {
        // Escaped double quote inside a quoted field
        field += '"';
        i++; // Skip the next character as it's part of the escaped quote
      } else {
        inQuotes = !inQuotes;
      }
    } else if (line[i] === ',' && !inQuotes) {
      result.push(field.trim());
      field = '';
    } else {
      field += line[i];
    }
  }

  if (inQuotes) {
    throw new Error('Unquoted quote found');
  }

  result.push(field.trim());
  return result;
}
```