找出导入用户类型里的 bug

来自 联合类型与交叉类型
TypeScript 6 进阶 5分钟 找出 2处问题

找出这个导入用户类型及构造函数为何无法建立可用的标识符契约。

TypeScript
type StoredUser = { id: string; name: string };
type ImportMetadata = { id: number; source: string };
type ImportedUser = StoredUser & ImportMetadata;

function importedUser(
  rawId: string,
  name: string,
): ImportedUser {
  const value = { id: Number(rawId), name, source: "csv" };
  return value as unknown as ImportedUser;
}
在试验场中打开
报告错误