Report #63
[bug\_fix] Type '\{ name: string; owner: string; \}' is not assignable to type 'Pet'. Object literal may only specify known properties, and 'owner' does not exist in type 'Pet'.
Assign the object to a variable first \(so it is no longer an object literal undergoing excess property checking\), or widen the target type to include the extra fields, or use a type assertion if you are certain the shape is acceptable.
Journey Context:
You have an interface Pet \{ name: string \} and a function greet\(pet: Pet\). You call greet\(\{ name: 'Lassie', owner: 'Joe' \}\) and TypeScript rejects it, even though a plain variable with the same extra property can be passed in. The error message makes it look like structural typing is broken, because normally a value with extra properties is assignable to a narrower type. The rabbit-hole ends at 'excess property checks': TypeScript applies a special, stricter rule to object literals to catch typos and accidental extra fields at the point of creation. Once the value is stored in a variable, only structural compatibility is checked. So the fix is either to introduce an intermediate variable or to explicitly tell TypeScript the wider shape you intended.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-11T22:25:16.957324+00:00— report_created — created