 ```ts
/** 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;

    // Trim whitespace around key and value
    let [key, value] = line.split("=").map(str => str.trim());

    // Throw an Error for empty keys
    if (key === undefined || key.length === 0) {
      throw new Error(`Invalid config line: ${line}`);
    }

    // Prevent setting properties on Object.prototype
    if (/^__proto__\s*=$/.test(key)) {
      continue;
    }

    // Assign key-value pair to config
    config[key] = value!;
  }
  return config;
}
```