diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 538a80e955a..6d62d7b67d9 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8955,6 +8955,7 @@ namespace ts { reportError(Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(prop), typeToString(target)); } else { + // use the property's value declaration if the property is assigned inside the literal itself const objectLiteralDeclaration = source.symbol && firstOrUndefined(source.symbol.declarations); if (prop.valueDeclaration && findAncestor(prop.valueDeclaration, d => d === objectLiteralDeclaration)) { errorNode = prop.valueDeclaration;