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