ProjectStack
typescript

TS2339: Property 'X' does not exist on type 'Y'

You're accessing a property that TypeScript doesn't know exists on that type. Either the property name is misspelled, the type definition is incomplete, or you're accessing a property from a different type than you think.

Common causes

  • Typo in the property name — TypeScript is case-sensitive
  • The property exists at runtime but isn't in the TypeScript type definition
  • You're accessing a property on a union type that only exists on one member
  • Using a DOM method or property that's missing from the TypeScript lib type definitions

How to fix it

  1. Fix the spelling — check the exact property name on the type definition
  2. Add the missing property to the type interface: interface MyType { newProp: string }
  3. Narrow the type before accessing: if ('propName' in obj) { obj.propName }
  4. If using a library, install its type definitions: npm install --save-dev @types/library-name

Example

const user = { name: 'Alice' }; console.log(user.email); // error TS2339: Property 'email' does not exist on type '{ name: string; }'.

Accessing a property not defined on the object literal's inferred type

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.