Code QuizIntermediate

Combining Aliases Wrong

Identify why properties are inaccessible on a combined type.

Codetypescript
type Named = { name: string };
type Aged = { age: number };

type Person = Named | Aged;

function greet(p: Person) {
  return `${p.name} is ${p.age}`;
}

What is the bug when accessing p.name and p.age?