```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(`Line "${line}" has no "="`);
    const key = line.slice(0, idx).trim();
    if (key === "") throw new Error(`Line "${line}" has an empty key`);
    const value = line.slice(idx + 1).trim().split("=")[0];
    config[key] = value;
  }
  return config;
}
```