```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 idx = line.indexOf("=");
    if (idx === -1) throw new Error(`Invalid line: ${line}`);
    const key = line.substring(0, idx).trim();
    if (key === "") throw new Error(`Empty key on line: ${line}`);
    const value = line.substring(idx + 1).trim();
    config[key] = value;
  }
  return config;
}
```