Skip to content
Latchkey

TS2339: Property does not exist on type - in CI

You accessed a property the compiler cannot find on the inferred or declared type.

What this error means

Type-checking fails with TS2339 naming the property and the type it is missing from.

tsc
src/user.ts(12,18): error TS2339: Property 'email' does not exist on type '{ id: number; }'.

Common causes

How to fix it

Type the value correctly

  1. Declare an interface that includes the property
  2. Annotate the variable or function return with that type
ts
interface User { id: number; email: string }
const u: User = await getUser()

Narrow a union before access

  1. Use a type guard (in, typeof, discriminant) so the branch has the property
ts
if ('email' in u) console.log(u.email)

How to prevent it

  • Type external data with explicit interfaces and narrow unions before member access rather than casting.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →