Reversed in Operator Branches
The in operator narrows correctly but each branch accesses the wrong shape's property.
Codetypescript
type Admin = { role: string; permissions: string[] };
type User = { name: string };
function describe(person: Admin | User) {
if ("permissions" in person) {
return person.name;
}
return person.permissions;
}What is wrong with these branches?