```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 || line.trim()[0] === "#") continue;
    const trimmedLine = line.trim();
    const [key, value] = trimmedLine.split("=", 2);
    if (!key || !value) throw new Error(`Invalid config on line: ${trimmedLine}`);
    key = key.trim();
    value = value.trim();
    config[key] = value;
  }
  return config;
}
```