In this guide
A simple guide to this issue: TypeScript 'Property does not exist on type' Error. Learn why it happens, what to check first, and how to fix it.
Error TS2339 is TypeScript doing its job: you are reading a property it cannot prove exists. The right fix is almost never any — it is giving the compiler the type information it is missing.
The Error
Property 'name' does not exist on type '{}'. (ts2339)
Fix 1: Type Your API Responses
response.json() returns any/unknown. Tell TS what shape it is:
interface User { id: string; name: string; email: string; }
const res = await fetch("/api/user");
const user = (await res.json()) as User;
console.log(user.name); // ✅ known propertyFix 2: Narrow Union Types Before Access
type Shape =
| { kind: "circle"; radius: number }
| { kind: "square"; side: number };
function area(s: Shape) {
if (s.kind === "circle") return Math.PI * s.radius ** 2; // narrowed
return s.side ** 2;
}Fix 3: Index Signatures for Dynamic Keys
const config: Record<string, string> = {};
config["theme"] = "dark"; // ✅ any string key allowedFix 4: Augment a Third-Party Type
When a library is missing a property you need (e.g. a custom field on the Express Request), declare it once via module augmentation rather than casting everywhere.
Avoid the any Escape Hatch
Casting to any silences the error but throws away every guarantee TypeScript gives you. Prefer typing the source. If you must escape, use unknown and narrow.
Relevant Scaleup Infotech Services
Keep Reading
Fix React Search Results Showing the Wrong Data
Fix React search race conditions with request cleanup, cancellation, and stale-response checks. Includes code and a slow-network verification checklist.
5 min readFix Next.js Environment Variables Missing in Production
Fix missing Next.js production environment variables by checking build-time values, public prefixes, deployment settings, and the exact release artifact.
5 min readFix Laravel Queue Jobs Not Processing After Deployment
Recover Laravel queue jobs after deployment by checking the connection, queue name, workers, cached configuration, failed jobs, and restart behavior.
5 min read