TS2551
TypeScript Programming Language
Severity: MinorWhat Does This Error Mean?
TypeScript error TS2551 means you used a property name that does not exist on the type, but TypeScript found a very similar property name that you probably meant. The full message is: 'Property X does not exist on type Y. Did you mean Z?' This is almost always a typo or a capitalization mistake. TypeScript is smart enough to suggest what you likely meant — the fix is usually just correcting the spelling.
Affected Models
- TypeScript 2.1 and later
- All TypeScript versions
- tsc compiler, ts-node, all TypeScript toolchains
Common Causes
- A typo in a property name — for example, writing .lenght instead of .length
- A capitalization mistake — JavaScript property names are case-sensitive, so .onClick is different from .onclick
- The property was renamed in a newer version of a library and your code still uses the old name
- Confusing similar property names on different types — for example, .size on a Map versus .length on an Array
- Using a browser API property name from memory when the actual name is slightly different
How to Fix It
-
Read the error message. TypeScript says 'Did you mean X?' — use X. Change the misspelled property name to the suggestion TypeScript provides.
TypeScript's suggestion in TS2551 is accurate the vast majority of the time. This is one of the friendliest TypeScript errors — it tells you exactly what to write.
-
In VS Code, the misspelled property is underlined in red. Click on it and press Ctrl+. (Quick Fix). VS Code will offer to apply the correction automatically.
The quick fix applies the TypeScript suggestion with a single click. You do not have to type anything.
-
Check the capitalization carefully. JavaScript property names are case-sensitive. Common mistakes include using innerHTML instead of innerHTML (correct), onclick instead of onClick for React, or innerText instead of innerText.
Web APIs use camelCase, all-lowercase, or sometimes all-lowercase with no separators. There is no single rule — you need to check the documentation or use your IDE's autocomplete to see the exact name.
-
If you renamed a property in your own type or interface, use your editor's 'Rename Symbol' feature (F2 in VS Code) to update all usages at once rather than finding them manually.
Rename Symbol updates every reference to the property across your entire project simultaneously. It is much safer and faster than a find-and-replace.
-
If you are using a library and the property was renamed in a recent update, check the library's changelog or migration guide. Update your code to use the new property name.
Libraries sometimes rename properties between major versions. The changelog will list breaking changes and what to use instead.
When to Call a Professional
TS2551 is almost always a simple typo or naming mistake. No outside help is needed. TypeScript's suggestion in the error message is almost always the correct fix — just use the name it suggests.
Frequently Asked Questions
What is the difference between TS2551 and TS2339?
TS2339 means the property simply does not exist on the type — TypeScript has no suggestion about what you meant. TS2551 is a smarter version of the same error: the property does not exist, but TypeScript found a very similar name and offers a suggestion. TS2551 is essentially TS2339 with a helpful hint attached.
TypeScript suggests the wrong property. How do I find the right one?
Type a dot after your object in VS Code to trigger autocomplete — this shows all available properties on that type. You can also hover over the type name to see its full definition. For external libraries, the official documentation lists all available properties with their exact names.
I fixed the spelling but now I get TS2339 instead. What does that mean?
It means the corrected name also does not exist — the TypeScript suggestion was a near-match but not the exact right property. Open the type definition (Ctrl+click on the type name in VS Code) to see all its actual properties. Or use autocomplete (dot notation) to browse the available properties directly.