```ts
/** The KEY=VALUE pairs of a config file. */
export function parseConfig(text: string): Record<string, string> {
  const config: Record<string, string> = {};
  const lines = text.split("\n");

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

    // Ignore blank lines and comments
    if (!line || line.startsWith("#")) continue;

    // Find the first occurrence of '='
    const equalIndex = line.indexOf("=");
    if (equalIndex === -1) {
      throw new Error(`Line ${i + 1} is missing a '='`);
    }

    const key = line.slice(0, equalIndex).trim();
    const value = line.slice(equalIndex + 1).trim();

    // Ignore lines with empty keys
    if (!key) {
      throw new Error(`Line ${i + 1} has an empty key`);
    }

    // Avoid modifying Object.prototype
    if (key === "__proto__") {
      config["__proto_key"] = value;
    } else {
      config[key] = value;
    }
  }

  return config;
}
```