Skip to content

Commit 515ddc2

Browse files
committed
Fix isConstructorParameter
1 parent 86f6378 commit 515ddc2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/compiler/checker.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4427,10 +4427,17 @@ namespace ts {
44274427
error(node, Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface);
44284428
return unknownType;
44294429

4430-
function isConstructorParameter(node: TypeNode, container: Node) {
4430+
function isConstructorParameter(node: Node, container: Node) {
44314431
if (container.kind === SyntaxKind.Constructor) {
44324432
let ctor = (<ConstructorDeclaration>container);
4433-
return !ctor.body.statements.some(st => st === node.parent);
4433+
while (node && node !== ctor) {
4434+
if (node === ctor.body) {
4435+
return false;
4436+
}
4437+
node = node.parent;
4438+
}
4439+
4440+
return true;
44344441
}
44354442
}
44364443
}

0 commit comments

Comments
 (0)