From 72a1e85cd7f1b189b509a723ed8473ae265573ca Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 6 Dec 2016 13:04:45 -0800 Subject: [PATCH] Check binding initialisers in parameters as well --- src/compiler/checker.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7ea84d093ec..61ccbff9bb0 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -17041,7 +17041,8 @@ namespace ts { // so we need to do a bit of extra work to check if reference is legal const enclosingContainer = getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { - if (symbol.valueDeclaration.kind === SyntaxKind.Parameter) { + if (symbol.valueDeclaration.kind === SyntaxKind.Parameter || + symbol.valueDeclaration.kind === SyntaxKind.BindingElement) { // it is ok to reference parameter in initializer if either // - parameter is located strictly on the left of current parameter declaration if (symbol.valueDeclaration.pos < node.pos) {