Learn why TypeScript throws TS2551 with a 'did you mean' suggestion for misspelled property names, and how to fix typos.
TS2551 is a friendlier version of TS2339 ("Property does not exist on type"). It fires when you try to access a property that doesn't exist on a type, but TypeScript detects a similarly-named property and offers a "Did you mean?" suggestion.
This is one of TypeScript's most helpful error messages because it usually identifies the exact fix. The suggestion is based on string similarity (Levenshtein distance), so it catches common typos like swapped letters, missing characters, or wrong casing.
// The general shape of the error:
// Property 'naem' does not exist on type 'User'. Did you mean 'name'?
// ~~~~ ~~~~
// what you wrote what existsThe most common cause — you misspelled a property name when accessing it.
// ❌ Broken
interface Product {
name: string
price: number
description: string
}
function formatProduct(product: Product) {
return `${product.naem} - $${product.pirce}`
// ~~~~ ~~~~~
// Error: Property 'naem' does not exist on type 'Product'. Did you mean 'name'?
// Error: Property 'pirce' does not exist on type 'Product'. Did you mean 'price'?
}// ✅ Fixed — correct the typos
function formatProduct(product: Product) {
return `${product.name} - $${product.price}`
}When working with APIs that return snake_case properties, it's easy to accidentally use camelCase or vice versa.
// ❌ Broken
interface ApiResponse {
user_id: number
first_name: string
last_name: string
created_at: string
}
function displayUser(response: ApiResponse) {
console.log(response.firstName)
// ~~~~~~~~~
// Error: Property 'firstName' does not exist on type 'ApiResponse'.
// Did you mean 'first_name'?
}// ✅ Fixed — use the correct casing
function displayUser(response: ApiResponse) {
console.log(response.first_name)
}Sometimes the property exists, just on a different type than the one you're accessing.
// ❌ Broken
interface Order {
orderId: string
items: OrderItem[]
totalAmount: number
}
interface OrderItem {
productName: string
quantity: number
}
function getOrderSummary(order: Order) {
return order.productName
// ~~~~~~~~~~~
// Error: Property 'productName' does not exist on type 'Order'.
// Did you mean to access it on 'OrderItem'?
}// ✅ Fixed — access the property on the correct object
function getOrderSummary(order: Order) {
return order.items.map((item) => item.productName)
}Check the suggestion. In the vast majority of cases, the "Did you mean?" suggestion is correct. Rename your property access to match.
Use your editor's quick-fix. Most editors (VS Code, WebStorm, etc.) offer a one-click fix for TS2551. Hover over the error and select the suggested correction.
If the property should exist on the type, add it to the interface or type definition rather than just renaming your access:
// If you genuinely need a new property, extend the type
interface Product {
name: string
price: number
sku: string // add the missing property
}Check for inconsistent naming conventions. If your codebase mixes camelCase and snake_case, consider normalizing the data at the boundary (e.g., when parsing API responses) so the rest of your code uses a consistent style.
Search for other occurrences. If you misspelled a property once, you probably misspelled it elsewhere. Use find-and-replace to catch all instances.
TS2551 fires when you access a property that doesn't exist on a given type, but TypeScript finds a similar property name on that same type. It's essentially a typo detector. TypeScript compares what you wrote against all known properties on the type and, if it finds a close match, includes the "Did you mean?" suggestion in the error message.
If there's no similar property at all, you'll get TS2339 instead (the plain "Property does not exist" error without a suggestion).
The simplest fix is to accept the suggestion and rename the property to match what TypeScript recommends. In VS Code, you can press Ctrl+. (or Cmd+. on macOS) on the error to apply the quick fix automatically. If you believe the property genuinely should exist but doesn't, you need to add it to the type definition.
TypeScript's compiler is intentionally conservative — it reports errors but doesn't modify your source code. The "Did you mean?" suggestion is a hint, not a certainty. You might have intended a completely different property, or the type itself might need updating. Your editor's language service can apply these fixes interactively, giving you the chance to review each one before accepting it.
Get the latest TypeScript tips, tutorials, and course updates delivered straight to your inbox.