cf.completefrontend

Predict the typesEasy

All three objects have an extra admin property. Which lines does TypeScript reject?

Say every error TypeScript reports for this code, and why the other lines compile.

What does TypeScript report here?
interface User {  name: string;  age: number;} function greet(user: User) {  return `Hi, ${user.name}`;} greet({ name: "Ada", age: 36, admin: true }); const ada = { name: "Ada", age: 36, admin: true };greet(ada); const older: User = { ...ada, age: 37 };

Work it out first: the compiler shows every error and type.

The answer

Work out every error TypeScript reports and every type it shows, line by line. Then check.

Checking your sign-in…