Spot the bug in ImportedUser

from Union and intersection types
TypeScript 6 intermediate 5 min 2 issues to find

Find why this imported-user type and constructor do not establish a usable identifier contract.

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;
}
Open in playground
Report an error