```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')) {
    if (line.trim() === '' || line.trim().startsWith('#')) continue; // ignore blank lines and comments

    const equalSignIdx = line.indexOf('=');
    if (equalSignIdx === -1) throw new Error(`Invalid line: ${line}`); // throw if no '='
    let [key, value] = [line.slice(0, equalSignIdx).trim(), line.slice(equalSignIdx + 1).trim()];

    if (!key || key === "__proto__") throw new Error(`Invalid key: ${key}`);  // throw if empty key or trying to set prototype property
      
    config[key] = value; // set the config key-value pair
  }
  return config;
}
```