tsc TS2339: Property 'x' does not exist on type 'Y' in CI
TS2339 means tsc inferred a type for the value that has no such property. The access may be valid at runtime, but the static type does not declare the member, so type-checking fails.
What this error means
tsc fails with "error TS2339: Property 'x' does not exist on type 'Y'", sometimes adding "Did you mean 'z'?" when a similar member exists.
src/user.ts:7:14 - error TS2339: Property 'fullName' does not exist on type 'User'.
7 return user.fullName;
~~~~~~~~Common causes
The member is genuinely not on the declared type
A typo, a renamed field, or a property added at runtime but never in the interface produces a type that lacks the member.
The value is typed too narrowly or as a base type
tsc inferred a narrow union member or a base interface that does not include the property you expect.
How to fix it
Add the property to the type or fix the access
- Check the type named after "on type" to see what members it declares.
- Correct a typo, or add the missing field to the interface if it should exist.
- Re-run tsc to confirm the property is now recognized.
interface User {
id: string;
fullName: string; // declare the field you access
}Narrow a union before accessing member-specific properties
When the value is a union, guard for the variant that has the property before reading it.
if ('fullName' in user) {
return user.fullName;
}How to prevent it
- Keep interfaces in sync with the objects they describe.
- Prefer discriminated unions with guards over loose
anyaccess. - Enable strict mode so missing members are caught consistently.