diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c795cdc7861..10038495fdb 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9070,7 +9070,7 @@ namespace ts { const propDeclaration = prop.valueDeclaration as ObjectLiteralElementLike; Debug.assertNode(propDeclaration, isObjectLiteralElementLike); - if (getContainingStatement(errorNode) === getContainingStatement(propDeclaration)) { + if (findAncestor(errorNode, isStatement) === findAncestor(propDeclaration, isStatement)) { errorNode = propDeclaration; } @@ -12815,13 +12815,6 @@ namespace ts { undefined; } - function getContainingStatement(node: Node): Node { - while (node && !isStatement(node)) { - node = node.parent; - } - return node; - } - function getThisTypeArgument(type: Type): Type { return getObjectFlags(type) & ObjectFlags.Reference && (type).target === globalThisType ? (type).typeArguments[0] : undefined; }