```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").filter(Boolean)) {
    if (!line.trim().startsWith('#')) {
      const [key, value] = line.split('=', 2);
      if (!key || !value) {
        throw new Error(`Invalid configuration line at line: ${line}`);
      }
      config[trim(key)] = trim(value);
    }
  }
  return config;
}
```