We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
isConstructorParameter
1 parent 86f6378 commit 515ddc2Copy full SHA for 515ddc2
src/compiler/checker.ts
@@ -4427,10 +4427,17 @@ namespace ts {
4427
error(node, Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface);
4428
return unknownType;
4429
4430
- function isConstructorParameter(node: TypeNode, container: Node) {
+ function isConstructorParameter(node: Node, container: Node) {
4431
if (container.kind === SyntaxKind.Constructor) {
4432
let ctor = (<ConstructorDeclaration>container);
4433
- return !ctor.body.statements.some(st => st === node.parent);
+ while (node && node !== ctor) {
4434
+ if (node === ctor.body) {
4435
+ return false;
4436
+ }
4437
+ node = node.parent;
4438
4439
+
4440
+ return true;
4441
}
4442
4443
0 commit comments