```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.startsWith("#")) continue;

    // Extract key and value
    const parts = line.split("=", 2);
    if (parts.length !== 2) throw new Error(`Invalid config line: ${line}`);

    const [key, value] = parts.map(part => part.trim());
    if (!key) throw new Error(`Empty key in config line: ${line}`);

    // Assign value to key, overwriting previous occurrences
    Object.defineProperty(config, key, {
      value,
      writable: true,
      enumerable: true,
      configurable: true
    });
  }
  return config;
}
```