```ts
/** The KEY=VALUE pairs of a config file. */
export function parseConfig(text: string): Record<string, string> {
  const config: Record<string, string> = Object.create(null);
  
  for (const line of text.split("\n")) {
    // Trim the line to check for blank lines and comments
    const trimmedLine = line.trim();
    
    // Skip blank lines
    if (trimmedLine === "") {
      continue;
    }
    
    // Skip comment lines (first non-space character is #)
    if (trimmedLine.startsWith("#")) {
      continue;
    }
    
    // Find the first '=' to split on
    const equalsIndex = line.indexOf("=");
    
    // Throw error if no '=' found
    if (equalsIndex === -1) {
      throw new Error(`Line has no '=': ${line}`);
    }
    
    // Extract key and value
    const key = line.substring(0, equalsIndex).trim();
    const value = line.substring(equalsIndex + 1).trim();
    
    // Throw error if key is empty
    if (key === "") {
      throw new Error(`Empty key in line: ${line}`);
    }
    
    // Use Object.create(null) to avoid prototype pollution, so direct assignment is safe
    config[key] = value;
  }
  
  return config;
}
```