Special Sponsor:PromptBuilder— Fast, consistent prompt creation powered by 1,000+ expert templates.
Make your Product visible here.Contact Us

Home/TypeScript Errors/TS2559

TS2559

Type 'X' has no properties in common with type 'Y'

TypeScript TS2559 fires when you assign an object literal to a type, and the object has no properties that exist in the target type. This is TypeScript's 'excess property checking' — it's stricter for object literals than for variables.

Why This Happens

You're passing an object literal with properties that don't exist in the target type's definition, and those properties have no overlap with the expected type. TypeScript's excess property checking catches this at object literal assignment sites.

Code That Triggers TS2559

// TS2559 examples
interface Point { x: number; y: number }

// Object with completely different properties
const p: Point = { a: 1, b: 2 };
// Error: Type '{ a: number; b: number }' has no properties in common with type 'Point'

// Function call with wrong object shape
function render(opts: { width: number; height: number }) {}
render({ color: "red", opacity: 0.5 });
// Error: Argument of type '{ color: string; opacity: number }' has no properties
// in common with type '{ width: number; height: number }'

How to Fix TS2559

Option 1: Add the correct properties to the object

const p: Point = { x: 1, y: 2 }; // use the properties Point requires

Option 2: Update the type to include the properties you need

interface ExtendedPoint extends Point {
  label?: string; // add what you need
}

Option 3: Use a type assertion when interfacing with dynamic data

const p = { a: 1, b: 2 } as unknown as Point; // escape hatch

Frequently Asked Questions — TS2559

What does TS2559 mean?

TS2559 means the object you're providing shares no properties with the expected type — they're completely different shapes. Check the target type's required properties and ensure your object has at least some of them.

How is TS2559 different from TS2322?

TS2322 is a general type mismatch. TS2559 is specifically for object literals where there's zero property overlap. TS2559 is often a sign of a completely wrong object being passed.

When does TypeScript's excess property checking trigger?

Only for object literals assigned directly to a typed variable or passed as arguments. If you assign to a variable first and then pass it, excess property checking is less strict.

TS2559 in React — what causes it?

Passing props with completely wrong names — for example, using HTML attribute names when the component expects custom prop names, or misspelling multiple prop names at once.

How do I add extra properties to an object that TypeScript doesn't expect?

Extend the interface with the additional properties, or use an index signature: interface Flexible { [key: string]: unknown; width: number; height: number }.

Convert JavaScript to TypeScript automatically

Paste your JS code and get type-annotated TypeScript — including fixes for common type errors — in seconds.

Try the converter →

Other TypeScript Errors

From the blog

View all →