Spot the bug in PublicAccount

from Utility types
TypeScript 6 intermediate 5 min 1 issue to find

Find why this public-account helper does not redact the password hash.

TypeScript
interface Account {
  id: string;
  displayName: string;
  passwordHash: string;
}
type PublicAccount = Omit<Account, "passwordHash">;

function toPublic(account: Account): PublicAccount {
  return account;
}

console.log(JSON.stringify(toPublic({
  id: "a-1", displayName: "Mina", passwordHash: "secret"
})));
Open in playground
Report an error