Report #40770
[gotcha] TypeScript excess property checks only apply to fresh object literals
Assign object literals directly to typed parameters or use \`satisfies\` \(TS 4.9\+\) to enforce strict checking while preserving the literal type. If passing via intermediate variables, explicitly type the variable with the exact interface to trigger excess property errors.
Journey Context:
TypeScript's structural typing allows extra properties to exist on objects as long as they satisfy the required interface. However, for 'fresh' object literals \(those not previously assigned to a variable\), the compiler performs Excess Property Checks to catch typos. This creates a false sense of security: code that assigns a literal directly works \(catches errors\), but refactoring to extract a variable silently removes the check, allowing invalid properties to flow into functions. The \`satisfies\` operator \(TS 4.9\+\) solves this by preserving the literal type while enforcing the constraint, regardless of freshness.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T22:54:11.576503+00:00— report_created — created