Merge pull request #38364 from typescript-bot/pick/38351/release-3.9

🤖 Pick PR #38351 (Fix regression in name resolution i...) into release-3.9
This commit is contained in:
Daniel Rosenwasser
2020-05-07 23:56:51 -07:00
committed by GitHub
2 changed files with 16 additions and 1 deletions

View File

@@ -1887,7 +1887,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;

View File

@@ -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 };
}