Scaleup Infotech
Scaleup Infotech.
Back to Blog
Bug Fixes8 min read

Fix TypeScript 'Property does not exist on type' Error

Scaleup Infotech Team

Scaleup Infotech Team

Software & Marketing Agency

Mar 21, 2026
TypeScriptTypesNarrowing

Direct Answer

This guide gives a simple overview of fix typescript 'property does not exist on type' error. If you need help turning the idea into a website, app, or business system, the related Scaleup Infotech services are listed below.

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:

ts
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 property

Fix 2: Narrow Union Types Before Access

ts
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

ts
const config: Record<string, string> = {};
config["theme"] = "dark"; // ✅ any string key allowed

Fix 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

Share this article:

Keep Reading

Ready to implement these ideas?

Work With Scaleup Infotech

Free Website Check

Pages, speed, forms