```typescript
/** The KEY=VALUE pairs of a config file. */
export function parseConfig(text: string): Record<string, string> {
  const config: Record<string, string> = {};
  for (const line of text.split("\n")) {
    // ignore blank lines and comments
    if (line.trim() === "" || line.trim().startsWith('#')) continue;

    const equalSignIndex = line.indexOf('=');
    if (equalSignIndex < 0) throw new Error(`Invalid line: ${line}`);

    // split on the first equals sign only, a value may contain one
    const key = line.slice(0, equalSignIndex).trim();
    const value = line.slice(equalSignIndex + 1).trim();

    if (key === '') throw new Error(`Empty key found in line: ${line}`);
    if (key === "__proto__") continue; // ignore __proto__ assignments

    config[key] = value;
  }
  return config;
}
```