Inline object types describe shape: { id: string; qty: number }. Excess property checks catch typos when assigning object literals.
Excess property checking
When you assign an object literal directly, TypeScript rejects unknown keys—this catches typos like quantiy instead of qty. Variables passed through may allow extra properties via structural typing rules.
Self-check
- Why is
const x: { a: number } = { a: 1, b: 2 }often an error?
Practice: Apply object-types in the playground, then explain object types in one sentence without looking at notes.