When TypeScript shows the error “Property does not exist on type…”, it usually appears in the middle of a refactor or when you are consuming an API, and can be confusing because the property clearly exists at runtime. This error is TypeScript’s way of telling you that the type you are working with does not define the property you are trying to access.
In this tutorial, you will learn the most common real-world reasons for this error—missing properties in interfaces, union types, dynamic JSON data, and third‑party library typings- and how to fix each of them step by step. We will start with simple cases and then move into more advanced patterns so that you can quickly understand what TypeScript is trying to tell you and systematically debug this error in your own projects.
What does this error mean
The “Property does not exist on type” error occurs when you try to access a property that TypeScript does not know exists on the given type. TypeScript enforces this to prevent runtime errors, especially in large codebases where accidental typos or mismatched data shapes can easily introduce bugs.
A simple example:
interface User {
name: string;
age: number;
}
const john: User = { name: "John Doe", age: 30 };
console.log(john.address);In this example, TypeScript throws an error because the address property is not defined in the User interface. Even if address exists at runtime, TypeScript only relies on the type definitions it sees.
TL;DR: Quick fixes
If you just want a quick checklist before diving deeper:
- Make sure the property is defined on the interface or type you are using.
- If the property is optional, mark it as optional (
?) in the type. - For union types, narrow to the specific member that has the property.
- For dynamic or JSON data, add explicit types or use type guards instead of
any. - For third‑party libraries, update or extend the type definitions rather than ignoring the error.
Cause 1: Missing property in the interface or type
The most common cause is that the property is not declared on the interface or type you are using.
Example: missing property
interface User {
name: string;
age: number;
}
const john: User = { name: "John Doe", age: 30 };
console.log(john.address); // Error: Property 'address' does not exist on type 'User'.To fix this, add the property to the interface. If the property is not always present, define it as optional:
interface User {
name: string;
age: number;
address?: string; // Optional property
}
const john: User = { name: "John Doe", age: 30 };
console.log(john.address); // OK, may be undefinedI executed the above example code and added the screenshot below.

This tells TypeScript that address might exist, and that its value can be string or undefined.
Cause 2: Type does not match the actual object
Sometimes the error appears because your type definition does not match the object’s actual shape. You might have changed the property name in one place but not in the type.
Example: mismatched property names
interface Product {
id: number;
name: string;
price: number;
}
const product = { id: 1, name: "Laptop", cost: 999.99 };
console.log(product.price);
// Error: Property 'price' does not exist on type '{ id: number; name: string; cost: number; }'.Here, the object uses cost while the interface expects price. You can fix this by either updating the object or adjusting the type.
Fix 1: Change the object to match the type
interface Product {
id: number;
name: string;
price: number;
}
const product: Product = { id: 1, name: "Laptop", price: 999.99 };
console.log(product.price); // OKI executed the above example code and added the screenshot below.

Fix 2: Change the type to match the object
interface Product {
id: number;
name: string;
cost: number;
}
const product: Product = { id: 1, name: "Laptop", cost: 999.99 };
console.log(product.cost); // OKThe key point is to keep your type definitions and actual objects in sync.
Cause 3: Union types where not all members have the property
Union types are another frequent source of this error. If a union type can be one of several shapes, TypeScript only allows you to access properties that exist on every member of the union, unless you narrow the type.
Example: union type without narrowing
interface Cat {
type: "cat";
name: string;
lives: number;
}
interface Dog {
type: "dog";
name: string;
barkVolume: number;
}
type Pet = Cat | Dog;
function printLives(pet: Pet) {
console.log(pet.lives);
// Error: Property 'lives' does not exist on type 'Pet'.
}Pet can be a Cat or a Dog, and only Cat has the lives property. To fix this, you must narrow the type before accessing lives.
Fix: use a discriminated union
function printLives(pet: Pet) {
if (pet.type === "cat") {
console.log(pet.lives); // OK, pet is a Cat here
} else {
console.log("Dogs do not have 'lives' property.");
}
}By checking pet.type, TypeScript understands that inside the if block, pet is a Cat, so lives exists.
Cause 4: Dynamic data, JSON, any, and unknown
When dealing with JSON or dynamic data, TypeScript often infers types like any or unknown. Accessing a property on such values without a proper type can either cause this error or hide potential issues.
Example: JSON.parse with unknown structure
const response = JSON.parse('{ "name": "John", "age": 30 }');
console.log(response.address);
// Depending on your configuration, this may either be allowed as 'any'
// or show an error if you use stricter settings.A better approach is to define an interface and assert or validate the parsed data.
interface User {
name: string;
age: number;
address?: string;
}
const response = JSON.parse('{ "name": "John", "age": 30 }') as User;
console.log(response.address); // OK, may be undefinedFor even better safety, you can combine runtime validation with TypeScript types, especially when consuming external APIs.
Cause 5: Narrowing and type guards not working as expected
Sometimes the error appears because TypeScript does not recognize your custom type guard or branching logic as narrowing the type. In that case, it still thinks the property might not exist.
Example: incomplete narrowing
type Shape =
| { kind: "circle"; radius: number }
| { kind: "square"; side: number };
function getRadius(shape: Shape) {
if ("radius" in shape) {
console.log(shape.radius); // OK
} else {
console.log(shape.radius);
// Error: Property 'radius' does not exist on type '{ kind: "square"; side: number; }'.
}
}
The error appears in the else block because there shape is the square variant, which does not have a radius.
A better approach is to design your unions with a discriminant and narrow based on it:
function getRadius(shape: Shape) {
if (shape.kind === "circle") {
console.log(shape.radius); // OK, shape is a circle here
} else {
console.log("This shape does not have a radius.");
}
}Clear discriminated unions help TypeScript understand which properties are valid in each branch.
Cause 6: Third‑party libraries and outdated typings
When using third‑party libraries, you may see this error if the library’s type definitions do not match the TypeScript version you are using or if the API is loosely typed.
Example: API call with generic response
import axios from "axios";
async function loadUser() {
const response = await axios.get("/api/user");
console.log(response.data.userName);
// Error (depending on typings): Property 'userName' does not exist on type 'any' or specific response type.
}
A more robust solution is to define an interface for the expected response and use generics.
interface UserResponse {
userName: string;
age: number;
}
async function loadUser() {
const response = await axios.get<UserResponse>("/api/user");
console.log(response.data.userName); // OK
}If the library typings are outdated or missing, you can install or update @types packages or write your own declaration file to keep TypeScript aligned with the actual behavior.
Cause 7: Extending types and inheritance
When working with inheritance or type extensions, the error can appear if you access a property that belongs to a derived type while using a base type reference.
Example: accessing child-specific property via base type
interface Person {
name: string;
age: number;
}
interface Employee extends Person {
employeeId: number;
}
const employee: Employee = { name: "Alice", age: 28, employeeId: 1234 };
function printEmployeeId(person: Person) {
console.log(person.employeeId);
// Error: Property 'employeeId' does not exist on type 'Person'.
}To fix this, accept Employee where you need employeeId, or narrow the type before accessing it.
function printEmployeeId(employee: Employee) {
console.log(employee.employeeId); // OK
}Or use a type guard if the function can receive different types:
tsfunction printEmployeeId(person: Person) {
if ("employeeId" in person) {
console.log((person as Employee).employeeId);
} else {
console.log("This person is not an employee.");
}
}Using type assertions carefully
Type assertions allow you to tell TypeScript, “Trust me, this value has this type.” They can fix this error quickly, but they should be used with care, because they can hide real bugs if misused.
Example: asserting unknown to a specific type
interface User {
name: string;
age: number;
}
function getUser(): unknown {
return { name: "Bob", age: 25 };
}
const user = getUser();
// console.log(user.name); // Error: Property 'name' does not exist on type 'unknown'.
const typedUser = user as User;
console.log(typedUser.name); // OKI executed the above example code and added the screenshot below.

Use assertions at well-defined boundaries, such as API responses or interoperating with non-TypeScript code, and prefer stricter types (unknown + checks) over any when possible.
How to systematically debug this error
When you see “Property does not exist on type…”, use this checklist to resolve it:
- Read the full error message and note the property and type names involved.
- Hover over the variable in your editor to see the type that TypeScript inferred.
- Check if the property is declared on that type (or its base interface) and if the spelling matches exactly.
- If the type is a union, verify whether all members contain that property; if not, narrow the union before accessing it.
- If the value comes from
any,unknown, orJSON.parse, add a proper type, interface, or type guard. - For values from third‑party libraries, inspect or update the type definitions and consider adding your own typings if necessary.
- Avoid silencing the error
anyunless you have no better option and document why it is safe.
Frequently asked questions
Why do I get this error even though the property exists at runtime?
TypeScript only checks against the types it knows at compile time. If the property is not declared in the interface or type, or if TypeScript cannot be sure it exists on all possible union members, it will report this error even if the property exists at runtime.
Can I just use any to fix this error?
You can, but it is generally not recommended. Using any removes type safety and can hide real bugs. Prefer defining proper interfaces, using union narrowing, or using unknown with runtime checks instead.
How do I handle properties that are not always present?
Mark them as optional with ? in your type definitions and handle the undefined case in your code. Optional properties make it clear to both TypeScript and readers of your code that the property may or may not be present.
Key takeaways
- The error “Property does not exist on type” means TypeScript cannot find a property on the type you are using, even if it exists at runtime.
- The most common causes are missing properties in interfaces, mismatched object shapes, union types without proper narrowing, dynamic data without explicit types, and outdated or incomplete library typings.
- Fix the error by aligning your types with your actual data, using discriminated unions and narrowing, correctly typing dynamic data, and updating or extending third‑party type definitions.
- Use type assertions and
anysparingly; prefer explicit, safe types wherever possible.
You may also read:
- 101 Best TypeScript Interview Questions and Answers for Experienced Professionals
- How to Check if an Object Implements an Interface in TypeScript?
- How to Remove a Property from an Object in TypeScript?
- How to Extend Interfaces with Classes in TypeScript?

Bijay Kumar is an experienced Python and AI professional who enjoys helping developers learn modern technologies through practical tutorials and examples. His expertise includes Python development, Machine Learning, Artificial Intelligence, automation, and data analysis using libraries like Pandas, NumPy, TensorFlow, Matplotlib, SciPy, and Scikit-Learn. At PythonGuides.com, he shares in-depth guides designed for both beginners and experienced developers. More about us.