```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; // Skip empty lines and comments
    const parts = line.split("=", 2); // Split on the first "=" only
    if (parts.length !== 2) throw new Error(`Line lacks an "=": "${line}"`);
    let [key, value] = parts.map(part => part.trim());
    if (!key) throw new Error(`Key is empty after trimming: "${line}"`);
    Object.defineProperty(config, key, {
      value,
      writable: true,
      enumerable: true,
      configurable: true
    });
  }
  return config;
}
```