ProjectStack
typescript

TS2741: Property 'X' is missing in type 'Y' but required in type 'Z'

You're passing an object or assigning a value where a required property is absent. TypeScript requires all non-optional properties to be present when creating or assigning objects to a typed interface or class.

Common causes

  • Forgetting to include a required field when creating an object literal
  • An interface was updated to add a required property but existing object literals weren't updated
  • Partially constructing an object and assigning it before all required fields are set
  • Spreading an object that's missing one of the required properties from the target type

How to fix it

  1. Add the missing property to your object: { name: 'Alice', email: '[email protected]' }
  2. Make the property optional in the interface if it's not always required: email?: string
  3. Use Partial<MyType> when building objects incrementally: const obj: Partial<MyType> = {}
  4. Check what the interface requires: hover over the type in your editor or look at its definition

Example

interface User { name: string; email: string; } const user: User = { name: 'Alice' }; // error TS2741: Property 'email' is missing in type '{ name: string; }' but required in type 'User'.

Creating an object literal that's missing a required property from its declared interface

Browse more errors

The Developer Hub covers 150+ errors across Git, npm, Node.js, Python, TypeScript, and Docker — with plain-English explanations and fix steps.