```typescript
/** 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()) continue; // Skip blank lines
    if (line.startsWith("#")) continue; // Skip comment lines

    const [key, value] = line.split("=", 2);
    if (!key) throw new Error(`Empty key at line "${line}"`);
    if (!value) throw new Error(`No '=' found at line "${line}"`);

    config[key.trim()] = value.trim();
  }
  return config;
}
```