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