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