```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 [key, ...value] = line.split('=');
      
    // Throw error for a line with no '=' or an empty key.
    if(!key || value.length === 0) throw new Error(`Invalid configuration line: ${line}`); 
  
    const trimmedKey = key.trim();
    // Prevent __proto__ as a key to ensure Object.prototype remains unchanged.
    if (trimmedKey === '__proto__') continue;
    
    config[trimmedKey] = value.join('=').trim(); // Join in case the Value includes an '='.
  }
  return config;
}
```