Report #71241
[bug\_fix] Object literal may only specify known properties, and 'extra' does not exist in type 'SomeType'
Use a type assertion to bypass excess property checking: \`processData\(\{ name: 'test', extra: 1 \} as SomeType\)\`, or assign the object to a variable first: \`const payload = \{ name: 'test', extra: 1 \}; processData\(payload\);\`. Alternatively, add an index signature to the interface: \`\[key: string\]: any\`.
Journey Context:
You define a strict interface \`CreateUserRequest \{ name: string; email: string; \}\` and a function \`createUser\(data: CreateUserRequest\)\`. You call it with an object literal: \`createUser\(\{ name: 'Alice', email: '[email protected]', phone: '123-456' \}\)\`. TypeScript immediately flags \`phone\` with the excess property error. You are confused because TypeScript uses structural typing and \`CreateUserRequest\` doesn't have a \`phone\` property to conflict with. You try \`as CreateUserRequest\` and the error disappears. You read the handbook and learn that TypeScript has a special 'excess property check' specifically for object literals to catch typos, which doesn't apply when you assign the object to a variable first. You realize the fix is either to remove the property, add it to the interface, or use a type assertion/type guard to bypass this specific literal check.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T02:09:35.064982+00:00— report_created — created