```typescript
/** The KEY=VALUE pairs of a config file. */
export function parseConfig(text: string): Record<string, string> {
  const config = {};
  for (const line of text.split("\n")) {
    if (!line.trim() || line.startsWith('#')) continue;
    let [key, value] = line.split('=', 2);
    key = key.trim();
    value = value.trim();
    while (value && !value[0]) {
      value = value.slice(1);
    }
    config[key] = value || throw new Error(`Missing value for key "${line}"`);
  }
  return Object.freeze(config);
}
```