Merge pull request #29298 from ajafff/this-reference-in-parameter

Allow referencing 'this' in parameters of functions in the constructor
This commit is contained in:
Ryan Cavanaugh
2019-01-30 19:13:18 -08:00
committed by GitHub
9 changed files with 56 additions and 18 deletions

View File

@@ -17019,7 +17019,7 @@ namespace ts {
}
function isInConstructorArgumentInitializer(node: Node, constructorDecl: Node): boolean {
return !!findAncestor(node, n => n === constructorDecl ? "quit" : n.kind === SyntaxKind.Parameter);
return !!findAncestor(node, n => isFunctionLikeDeclaration(n) ? "quit" : n.kind === SyntaxKind.Parameter && n.parent === constructorDecl);
}
function checkSuperExpression(node: Node): Type {