TypeScript compares types by shape, not by name. Two unrelated interfaces with the same members are interchangeable, which surprises developers coming from Java or C#.
interface Point { x: number; y: number }
interface Vector { x: number; y: number }
function log(p: Point) { console.log(p) }
log({ x: 1, y: 2 } satisfies Vector) // fine — same shape
This is by design: it matches how JavaScript objects actually behave at runtime, and it's what makes duck-typed APIs pleasant to use without a wall of boilerplate interfaces.
Excess property checks only apply to object literals assigned directly, not to variables. That inconsistency is the single most common source of "why did this compile?!" bug reports for TypeScript newcomers.
Want to advertise your product here? Contact Us
Great write-up, thanks for the clear examples!