midTypeScript
Discuss 'Excess Property Checks' and how to bypass them safely.
Updated May 4, 2026
Short answer
TypeScript checks for extra properties when an object literal is assigned directly to a type.
Deep explanation
Normally, TypeScript is structurally typed (extra properties are allowed). However, to catch typos, the compiler performs 'Excess Property Checking' (EPC) specifically during fresh object literal assignments. If you pass an object literal that contains properties not defined in the target interface, TS assumes it is a mistake. To bypass this, you can assign the literal to a variable first or use an index signature in the interface.
Real-world example
Defining configuration objects where you want to strictly enforce that no unsupported options are provided by the developer.
Common mistakes
- Thinking that EPC means TypeScript is nominally typed
- it is just a specific check for literals.
Follow-up questions
- How do you allow any extra property in an interface?