```ts
/**
 * The KEY=VALUE pairs of a config file, ignoring blank lines and lines starting with '#'.
 * White space around keys/values is trimmed. Values containing =
 may span on multiple lines, respecting the first '=' only.
 */
export function parseConfig(text: string): Record<string, string> {
  const config: Record<string, string> = {};
  for (const line of text.split("\n")) {
    if (line.trim().startsWith("#") || !line.includes("=")) continue;

    const key = trimFirst(line.trim(), "=");
    value = getKeyValue(line.trim());
    ensureValidKey(key);

    config[key] = String(value);
  }
  return config;
}

function getKeyValue(line: string): any {
  let result: any = line.trim();
  let depth = 1;

  for (let i = line.length - 1; i >= 0 && depth > 0; i--) {
    if (result[i] === "=") {
      if (depth === 1) return parseValue(result.substring(0, i));
    } else if (result[i] === "{") {
      depth++;
    } else if (result[i] === "}") {
      depth--;
    }
  }

  throw new Error(`Line ${line.trim()}: Expected '=' in value.`);
}

function parseValue(value: string): any {
  try {
    return JSON.parse(value);
  } catch {
    // Ignore extra commas and spaces, let value be a pure string.
    return value.replaceAll(/(\s|\n)+/g, "");
  }
}

function trimFirst(str: string, delim: string): string {
  const pos = str.indexOf(delim);
  if (pos === -1) return str;
  return str.substring(pos + delim.length);
}

function ensureValidKey(key: string): any {
  // No deep hierarchy check in this simple version.
  for (const proto of Object.getPrototypeOf(Object.prototype).prototype) {
    if (key === proto) throw new Error(`Line ${key.trim()}: Key cannot be the prototype.`);
  }
}
```