```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")) {
    if (line.trim() === "" || line.startsWith("#")) continue;
    const index = line.indexOf("=");
    if (index === -1) throw new Error(`Invalid configuration line: ${line}`);
    const key = line.substring(0, index).trim();
    const value = line.substring(index + 1).trim();
    if (key === "") throw new Error(`Empty key in configuration line: ${line}`);
    Object.defineProperty(config, key, { configurable: true, enumerable: true, writable: true, value });
  }
  return config;
}
```