Skip to content

Commit 659677f

Browse files
Merge pull request microsoft#38364 from typescript-bot/pick/38351/release-3.9
🤖 Pick PR microsoft#38351 (Fix regression in name resolution i...) into release-3.9
2 parents 9edf9ec + e6709a4 commit 659677f

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/compiler/checker.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1887,7 +1887,9 @@ namespace ts {
18871887
lastLocation === (location as BindingElement).name && isBindingPattern(lastLocation))) {
18881888
const root = getRootDeclaration(location);
18891889
if (root.kind === SyntaxKind.Parameter) {
1890-
associatedDeclarationForContainingInitializerOrBindingName = location as BindingElement;
1890+
if (!associatedDeclarationForContainingInitializerOrBindingName) {
1891+
associatedDeclarationForContainingInitializerOrBindingName = location as BindingElement;
1892+
}
18911893
}
18921894
}
18931895
break;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// @target: es5, es2015, esnext
2+
// @noEmit: true
3+
// @noTypesAndSymbols: true
4+
5+
// https://github.com/microsoft/TypeScript/issues/38243
6+
7+
function test0({ a = 0, b = a } = {}) {
8+
return { a, b };
9+
}
10+
11+
function test1({ c: { a = 0, b = a } = {} } = {}) {
12+
return { a, b };
13+
}

0 commit comments

Comments
 (0)