```ts
export function parseCsvLine(line: string): string[] {
  if (line === '') {
    return [''];
  }

  const result: string[] = [];
  let field = '';
  let inQuotes = false;

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

    if (char === '"') {
      if (inQuotes && nextChar === '"') {
        // Double quote inside quoted field -> literal quote
        field += '"';
        i++; // Skip the next quote
      } else {
        // Toggle quote state
        inQuotes = !inQuotes;
      }
    } else if (char === ',' && !inQuotes) {
      // Comma outside quotes -> end of field
      result.push(field);
      field = '';
    } else {
      // Regular character
      field += char;
    }
  }

  // Handle unclosed quoted field
  if (inQuotes) {
    throw new Error('Quoted field is never closed');
  }

  // Add the last field
  result.push(field);

  return result;
}
```