```ts
/**
 * Splits one line of CSV into its fields on commas.
 *
 * A field wrapped in double quotes may contain commas, and a doubled quote inside such a field means one literal quote character;
 * the surrounding quotes are not part of the value. Fields that are not quoted are taken literally, including any surrounding spaces.
 * An empty line is one empty field.
 *
 * @param {string} line - A line of CSV to split
 * @returns {Promise<string[]>} a promise that resolves with an array of fields
 */
export function parseCsvLine(line: string): Promise<string[]> {
    let currentField = '';
    const result: string[] = [];
    let inQuote = false;

    for (const char of line) {
        if (char === '"') {
            inQuote = !inQuote;
        } else if (!inQuote && char === ',') {
            if (currentField) {
                result.push(currentField);
            }
            currentField = '';
        } else {
            currentField += char;
        }
    }

    if (currentField) {
        result.push(currentField);
    }

    return new Promise((resolve, reject) => {
        if (!line.length) {
            resolve([]);
        }

        if (result.some(field => field === '') && !inQuote) {
            throw new Error('Empty line not allowed');
        }

        if (result.some(field => field.startsWith('"') && field.endsWith('"'))) {
            const quoteCount = result.filter(field => field.startsWith('"')).length;
            if (quoteCount % 2 !== 0) {
                reject(new Error('Invalid quoted field, never closed'));
            }
            // remove quotes and replace commas with spaces
            result.forEach(field => {
                field = field.slice(1, -1).replace(/,/g, ' ');
            });
        }

        resolve(result);
    });
}
```