- Error
- Reported by the type checker
TS2551
Property '{0}' does not exist on type '{1}'. Did you mean '{2}'?
A property that doesn't exist is accessed, and a similarly named one does. Usually a typo: use the suggested name.
What it means
This is TS2339 with a suggestion: the property doesn't exist on the type, but one with a close spelling does, and the message names it.
Example
const user = { firstName: "Ada" };
export const n = user.firstname;
ts-r-check -p tsconfig.json --pretty false ts-r outputindex.ts(2,23): error TS2551: Property 'firstname' does not exist on type '{ firstName: string; }'. Did you mean 'firstName'?
Recorded by node scripts/verify-examples.mjs with ts-r built from commit 6deaf01. The example uses the default tsconfig: strict, target: es2022, module: esnext, moduleResolution: bundler.
How to fix
- Use the suggested property name if it's what you meant.
- If the property should exist, add it to the type.