From 6aecd43d9a7edca358df3e0ef629e0b2d994c6d0 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 30 Oct 2015 15:03:44 -0700 Subject: [PATCH] Fix `isConstructorParameter` --- src/compiler/checker.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a1207d023c7..6ea8d896326 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4427,10 +4427,17 @@ namespace ts { error(node, Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface); return unknownType; - function isConstructorParameter(node: TypeNode, container: Node) { + function isConstructorParameter(node: Node, container: Node) { if (container.kind === SyntaxKind.Constructor) { let ctor = (container); - return !ctor.body.statements.some(st => st === node.parent); + while (node && node !== ctor) { + if (node === ctor.body) { + return false; + } + node = node.parent; + } + + return true; } } }