How to fix Type '{ x: string; }' is missing the following properties from type 'Y': name, age in TypeScript

TypeScriptBEGINNERMEDIUMUpdated Dec 11, 2025· 128 views

This TypeScript error occurs when you assign an object that lacks required properties defined in its type or interface. TypeScript enforces that objects must include all non-optional properties.

Quick fix

Fixes Type '{ x: string; }' is missing the following properties from type 'Y': name, age

Type '{ x: string; }' is missing the following properties from type 'Y': name, age
  1. Identify the missing properties from the error message
  2. Add all required properties to your object
  3. Mark properties as optional if they are not always required
  4. Use the Partial utility type for partial objects
typescript — error
Type '{ x: string; }' is missing the following properties from type 'Y': name, age
Type '{ x: string; }' is missing the following properties from type 'Y': name, age

What this error means

This error (TS2739) occurs when TypeScript detects that an object literal or variable is missing one or more required properties that are defined in the target type, interface, or class. TypeScript performs strict type checking to ensure type safety, and when you try to assign an object to a type, all required properties must be present. The error message explicitly lists which properties are missing, helping you identify what needs to be added. This commonly happens when creating objects, passing props to components, implementing interfaces, or initializing class instances. TypeScript's excess property checking ensures that your objects conform to their declared shapes at compile time, preventing runtime errors. This is a core feature of TypeScript's structural type system - objects must have at least the properties required by their type, though they can have additional properties in most contexts.

Typical symptoms

  • Compilation fails with error code TS2739
  • Error message lists specific properties that are missing from the type
  • Object assignment or function call is rejected by TypeScript
  • IDE shows red squiggly lines under object literals or variable assignments
  • React components fail to compile when required props are not passed
  • Class instances cannot be created due to missing interface properties

Common causes

  1. Creating an object literal without all required properties defined in the type or interface
  2. Passing incomplete props to a React component that requires specific properties
  3. Initializing a variable with an empty object when the type expects properties
  4. Implementing an interface in a class but forgetting to include all required properties
  5. Assigning a partial object to a variable typed with a complete interface
  6. Destructuring or spreading objects that do not include all required fields
  7. Typos in property names that cause TypeScript to treat them as missing

How to fix "Type '{ x: string; }' is missing the following properties from type 'Y': name, age"

1Identify the missing properties from the error message

Read the TypeScript error carefully - it explicitly tells you which properties are missing:

bash
Type '{ x: string; }' is missing the following properties from type 'Y': name, age

In this example, the type Y requires name and age properties, but the object only has x. Make a note of all missing properties listed.

2Add all required properties to your object

The most straightforward fix is to provide all required properties:

typescript
interface Person {
  name: string;
  age: number;
  email: string;
}

// ❌ Error: missing 'email'
const user: Person = {
  name: 'Alice',
  age: 30
};

// ✅ Fixed: all properties provided
const user: Person = {
  name: 'Alice',
  age: 30,
  email: 'alice@example.com'
};

Ensure every property required by the type is present in your object literal.

3Mark properties as optional if they are not always required

If certain properties should not be mandatory, mark them as optional using the ? operator:

typescript
interface Person {
  name: string;
  age: number;
  email?: string;  // Now optional
  phone?: string;  // Now optional
}

// ✅ Valid: optional properties can be omitted
const user: Person = {
  name: 'Alice',
  age: 30
};

This is useful when properties are truly optional in your application logic.

4Use the Partial utility type for partial objects

When you need to work with objects that may not have all properties (like during updates or initialization), use TypeScript's Partial<T> utility type:

typescript
interface Person {
  name: string;
  age: number;
  email: string;
}

// ✅ All properties are optional
const partialUser: Partial<Person> = {
  name: 'Alice'
};

// Useful for update functions
function updatePerson(id: string, updates: Partial<Person>) {
  // Only the provided fields will be updated
}

updatePerson('123', { age: 31 });

Other useful utility types: Required<T>, Pick<T, Keys>, and Omit<T, Keys>.

5Fix React component prop errors

For React components, ensure you pass all required props:

typescript
interface UserCardProps {
  name: string;
  age: number;
  email: string;
}

function UserCard({ name, age, email }: UserCardProps) {
  return <div>{name} - {age}</div>;
}

// ❌ Error: missing 'email' prop
<UserCard name="Alice" age={30} />

// ✅ Fixed: all props provided
<UserCard name="Alice" age={30} email="alice@example.com" />

// Alternative: make email optional in the interface
interface UserCardProps {
  name: string;
  age: number;
  email?: string;
}
6Implement all interface properties in classes

When a class implements an interface, it must include all required properties:

typescript
interface Vehicle {
  make: string;
  model: string;
  year: number;
  start(): void;
}

// ❌ Error: missing 'year' and 'start'
class Car implements Vehicle {
  make: string;
  model: string;

  constructor(make: string, model: string) {
    this.make = make;
    this.model = model;
  }
}

// ✅ Fixed: all interface members implemented
class Car implements Vehicle {
  make: string;
  model: string;
  year: number;

  constructor(make: string, model: string, year: number) {
    this.make = make;
    this.model = model;
    this.year = year;
  }

  start(): void {
    console.log('Engine started');
  }
}

Advanced notes

Type Assertion as a Last Resort: You can bypass this error using type assertions (as or <Type> syntax), but this defeats TypeScript's type safety and should be avoided:

typescript
const user = {} as Person;  // Compiles but unsafe

This can lead to runtime errors since the object truly doesn't have the required properties. Only use this in rare cases where you're absolutely certain the properties will be added dynamically.

Excess Property Checking: TypeScript treats object literals differently from variables. Object literals undergo "excess property checking" to catch typos and mistakes. If you assign an object to a variable first, then assign that variable to a typed variable, the excess property check is bypassed.

strictNullChecks: With strictNullChecks enabled in your tsconfig.json, properties typed as non-nullable cannot be undefined or null, which can also trigger this error if you try to initialize them incompletely.

Index Signatures: For objects with dynamic properties, consider using index signatures:

typescript
interface FlexiblePerson {
  name: string;
  age: number;
  [key: string]: string | number;  // Allows additional properties
}

Branded Types: For cases where you need to ensure an object is fully formed before use, consider branded types or factory functions that guarantee complete object construction.

Frequently asked questions

What does "Type '{ x: string; }' is missing the following properties from type 'Y" mean?
This error (TS2739) occurs when TypeScript detects that an object literal or variable is missing one or more required properties that are defined in the target type, interface, or class. TypeScript performs strict type checking to ensure type safety, and when you try to assign an object to a type, all required properties must be present. The error message explicitly lists which properties are missing, helping you identify what needs to be added.
How do I fix "Type '{ x: string; }' is missing the following properties from type 'Y"?
This TypeScript error occurs when you assign an object that lacks required properties defined in its type or interface. TypeScript enforces that objects must include all non-optional properties.
What causes "Type '{ x: string; }' is missing the following properties from type 'Y"?
Creating an object literal without all required properties defined in the type or interface Passing incomplete props to a React component that requires specific properties Initializing a variable with an empty object when the type expects properties
Is the "Type '{ x: string; }' is missing the following properties from type 'Y" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading