Report #54629
[bug\_fix] Object literal may only specify known properties, and 'colour' does not exist in type 'Config'. Did you mean to write 'color'?
Correct the typo in the property name, or use a type assertion to bypass excess property checks \(not recommended for typos\). Root cause: TypeScript performs excess property checking on object literals assigned to specific types to catch typos and misspellings. This check only applies to 'fresh' object literals \(not variables\), ensuring that you don't accidentally pass extra properties that the target type doesn't recognize, which often indicates a bug or API misuse.
Journey Context:
You're configuring a charting library in a React component. You write: \`const config: ChartConfig = \{ colour: '\#ff0000', width: 100 \};\`. TypeScript immediately flags 'colour' with error TS2322: 'Object literal may only specify known properties, and 'colour' does not exist in type 'ChartConfig'. Did you mean 'color'?'. You double-check the library docs - it's indeed 'color', not 'colour' \(British spelling\). You fix the typo. Later, you encounter a case where you genuinely need to pass extra properties for a plugin that extends the base config. You try: \`const extraConfig = \{ color: 'red', pluginData: true \}; const config: ChartConfig = extraConfig;\` and it compiles because excess property checks only apply to fresh object literals, not references. You realize this check saved you from a typo earlier, so you keep it enabled and use type assertions only when truly necessary, understanding that TypeScript is protecting you from spelling errors that would silently fail at runtime.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T22:11:16.216997+00:00— report_created — created