Skip to content
Quiz · Interfaces and structural typing · lesson 8 of 12

Quiz — a literal and a variable

On which line does tsc report an error?

TypeScript
interface Point { x: number; y: number }
const a = { x: 1, y: 2, z: 3 };
const p1: Point = a;
const p2: Point = { x: 1, y: 2, z: 3 };
console.log(p1.x, p2.x);