Skip to content

Commit 72a1e85

Browse files
committed
Check binding initialisers in parameters as well
1 parent 92f2721 commit 72a1e85

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17041,7 +17041,8 @@ namespace ts {
1704117041
// so we need to do a bit of extra work to check if reference is legal
1704217042
const enclosingContainer = getEnclosingBlockScopeContainer(symbol.valueDeclaration);
1704317043
if (enclosingContainer === func) {
17044-
if (symbol.valueDeclaration.kind === SyntaxKind.Parameter) {
17044+
if (symbol.valueDeclaration.kind === SyntaxKind.Parameter ||
17045+
symbol.valueDeclaration.kind === SyntaxKind.BindingElement) {
1704517046
// it is ok to reference parameter in initializer if either
1704617047
// - parameter is located strictly on the left of current parameter declaration
1704717048
if (symbol.valueDeclaration.pos < node.pos) {

0 commit comments

Comments
 (0)