Fix regression in name resolution in parameter

This commit is contained in:
Ron Buckton
2020-05-05 16:50:31 -07:00
parent c219fdae08
commit 39e68564ff
2 changed files with 16 additions and 1 deletions
+3 -1
View File
@@ -1889,7 +1889,9 @@ namespace ts {
lastLocation === (location as BindingElement).name && isBindingPattern(lastLocation))) {
const root = getRootDeclaration(location);
if (root.kind === SyntaxKind.Parameter) {
associatedDeclarationForContainingInitializerOrBindingName = location as BindingElement;
if (!associatedDeclarationForContainingInitializerOrBindingName) {
associatedDeclarationForContainingInitializerOrBindingName = location as BindingElement;
}
}
}
break;
@@ -0,0 +1,13 @@
// @target: es5, es2015, esnext
// @noEmit: true
// @noTypesAndSymbols: true
// https://github.com/microsoft/TypeScript/issues/38243
function test0({ a = 0, b = a } = {}) {
return { a, b };
}
function test1({ c: { a = 0, b = a } = {} } = {}) {
return { a, b };
}