Skip to content

Commit e1e32af

Browse files
committed
forbid expando missing namespaces on aliases
taken from #39558 as soon as it was created
1 parent f32ec4e commit e1e32af

File tree

3 files changed

+47
-45
lines changed

3 files changed

+47
-45
lines changed

Diff for: src/compiler/binder.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -2986,7 +2986,9 @@ namespace ts {
29862986
const excludeFlags = SymbolFlags.ValueModuleExcludes & ~SymbolFlags.Assignment;
29872987
namespaceSymbol = forEachIdentifierInEntityName(entityName, namespaceSymbol, (id, symbol, parent) => {
29882988
if (symbol) {
2989-
addDeclarationToSymbol(symbol, id, flags);
2989+
if (!(symbol.flags & SymbolFlags.Alias)) {
2990+
addDeclarationToSymbol(symbol, id, flags);
2991+
}
29902992
return symbol;
29912993
}
29922994
else {

Diff for: tests/baselines/reference/checkOtherObjectAssignProperty.symbols

+30-30
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,61 @@
11
=== tests/cases/conformance/jsdoc/importer.js ===
22
const mod = require("./mod1");
3-
>mod : Symbol(mod, Decl(importer.js, 0, 5), Decl(importer.js, 6, 9), Decl(importer.js, 9, 14), Decl(importer.js, 10, 14), Decl(importer.js, 11, 13) ... and 2 more)
3+
>mod : Symbol(mod, Decl(importer.js, 0, 5))
44
>require : Symbol(require)
5-
>"./mod1" : Symbol("tests/cases/conformance/jsdoc/mod1", Decl(mod1.js, 0, 0))
5+
>"./mod1" : Symbol(mod, Decl(mod1.js, 0, 0))
66

77
mod.thing;
8-
>mod.thing : Symbol(thing, Decl(mod1.js, 0, 42))
9-
>mod : Symbol(mod, Decl(importer.js, 0, 5), Decl(importer.js, 6, 9), Decl(importer.js, 9, 14), Decl(importer.js, 10, 14), Decl(importer.js, 11, 13) ... and 2 more)
10-
>thing : Symbol(thing, Decl(mod1.js, 0, 42))
8+
>mod.thing : Symbol(mod.thing, Decl(mod1.js, 0, 42))
9+
>mod : Symbol(mod, Decl(importer.js, 0, 5))
10+
>thing : Symbol(mod.thing, Decl(mod1.js, 0, 42))
1111

1212
mod.other;
13-
>mod : Symbol(mod, Decl(importer.js, 0, 5), Decl(importer.js, 6, 9), Decl(importer.js, 9, 14), Decl(importer.js, 10, 14), Decl(importer.js, 11, 13) ... and 2 more)
13+
>mod : Symbol(mod, Decl(importer.js, 0, 5))
1414

1515
mod.prop;
16-
>mod : Symbol(mod, Decl(importer.js, 0, 5), Decl(importer.js, 6, 9), Decl(importer.js, 9, 14), Decl(importer.js, 10, 14), Decl(importer.js, 11, 13) ... and 2 more)
16+
>mod : Symbol(mod, Decl(importer.js, 0, 5))
1717

1818
mod.bad1;
19-
>mod.bad1 : Symbol(bad1, Decl(mod1.js, 10, 72))
20-
>mod : Symbol(mod, Decl(importer.js, 0, 5), Decl(importer.js, 6, 9), Decl(importer.js, 9, 14), Decl(importer.js, 10, 14), Decl(importer.js, 11, 13) ... and 2 more)
21-
>bad1 : Symbol(bad1, Decl(mod1.js, 10, 72))
19+
>mod.bad1 : Symbol(mod.bad1, Decl(mod1.js, 10, 72))
20+
>mod : Symbol(mod, Decl(importer.js, 0, 5))
21+
>bad1 : Symbol(mod.bad1, Decl(mod1.js, 10, 72))
2222

2323
mod.bad2;
24-
>mod.bad2 : Symbol(bad2, Decl(mod1.js, 13, 44))
25-
>mod : Symbol(mod, Decl(importer.js, 0, 5), Decl(importer.js, 6, 9), Decl(importer.js, 9, 14), Decl(importer.js, 10, 14), Decl(importer.js, 11, 13) ... and 2 more)
26-
>bad2 : Symbol(bad2, Decl(mod1.js, 13, 44))
24+
>mod.bad2 : Symbol(mod.bad2, Decl(mod1.js, 13, 44))
25+
>mod : Symbol(mod, Decl(importer.js, 0, 5))
26+
>bad2 : Symbol(mod.bad2, Decl(mod1.js, 13, 44))
2727

2828
mod.bad3;
29-
>mod.bad3 : Symbol(bad3, Decl(mod1.js, 14, 77))
30-
>mod : Symbol(mod, Decl(importer.js, 0, 5), Decl(importer.js, 6, 9), Decl(importer.js, 9, 14), Decl(importer.js, 10, 14), Decl(importer.js, 11, 13) ... and 2 more)
31-
>bad3 : Symbol(bad3, Decl(mod1.js, 14, 77))
29+
>mod.bad3 : Symbol(mod.bad3, Decl(mod1.js, 14, 77))
30+
>mod : Symbol(mod, Decl(importer.js, 0, 5))
31+
>bad3 : Symbol(mod.bad3, Decl(mod1.js, 14, 77))
3232

3333

3434
mod.thing = 0;
35-
>mod.thing : Symbol(thing, Decl(mod1.js, 0, 42))
36-
>mod : Symbol(mod, Decl(importer.js, 0, 5), Decl(importer.js, 6, 9), Decl(importer.js, 9, 14), Decl(importer.js, 10, 14), Decl(importer.js, 11, 13) ... and 2 more)
37-
>thing : Symbol(thing, Decl(mod1.js, 0, 42))
35+
>mod.thing : Symbol(mod.thing, Decl(mod1.js, 0, 42))
36+
>mod : Symbol(mod, Decl(importer.js, 0, 5))
37+
>thing : Symbol(mod.thing, Decl(mod1.js, 0, 42))
3838

3939
mod.other = 0;
40-
>mod : Symbol(mod, Decl(importer.js, 0, 5), Decl(importer.js, 6, 9), Decl(importer.js, 9, 14), Decl(importer.js, 10, 14), Decl(importer.js, 11, 13) ... and 2 more)
40+
>mod : Symbol(mod, Decl(importer.js, 0, 5))
4141

4242
mod.prop = 0;
43-
>mod : Symbol(mod, Decl(importer.js, 0, 5), Decl(importer.js, 6, 9), Decl(importer.js, 9, 14), Decl(importer.js, 10, 14), Decl(importer.js, 11, 13) ... and 2 more)
43+
>mod : Symbol(mod, Decl(importer.js, 0, 5))
4444

4545
mod.bad1 = 0;
46-
>mod.bad1 : Symbol(bad1, Decl(mod1.js, 10, 72))
47-
>mod : Symbol(mod, Decl(importer.js, 0, 5), Decl(importer.js, 6, 9), Decl(importer.js, 9, 14), Decl(importer.js, 10, 14), Decl(importer.js, 11, 13) ... and 2 more)
48-
>bad1 : Symbol(bad1, Decl(mod1.js, 10, 72))
46+
>mod.bad1 : Symbol(mod.bad1, Decl(mod1.js, 10, 72))
47+
>mod : Symbol(mod, Decl(importer.js, 0, 5))
48+
>bad1 : Symbol(mod.bad1, Decl(mod1.js, 10, 72))
4949

5050
mod.bad2 = 0;
51-
>mod.bad2 : Symbol(bad2, Decl(mod1.js, 13, 44))
52-
>mod : Symbol(mod, Decl(importer.js, 0, 5), Decl(importer.js, 6, 9), Decl(importer.js, 9, 14), Decl(importer.js, 10, 14), Decl(importer.js, 11, 13) ... and 2 more)
53-
>bad2 : Symbol(bad2, Decl(mod1.js, 13, 44))
51+
>mod.bad2 : Symbol(mod.bad2, Decl(mod1.js, 13, 44))
52+
>mod : Symbol(mod, Decl(importer.js, 0, 5))
53+
>bad2 : Symbol(mod.bad2, Decl(mod1.js, 13, 44))
5454

5555
mod.bad3 = 0;
56-
>mod.bad3 : Symbol(bad3, Decl(mod1.js, 14, 77))
57-
>mod : Symbol(mod, Decl(importer.js, 0, 5), Decl(importer.js, 6, 9), Decl(importer.js, 9, 14), Decl(importer.js, 10, 14), Decl(importer.js, 11, 13) ... and 2 more)
58-
>bad3 : Symbol(bad3, Decl(mod1.js, 14, 77))
56+
>mod.bad3 : Symbol(mod.bad3, Decl(mod1.js, 14, 77))
57+
>mod : Symbol(mod, Decl(importer.js, 0, 5))
58+
>bad3 : Symbol(mod.bad3, Decl(mod1.js, 14, 77))
5959

6060
=== tests/cases/conformance/jsdoc/mod1.js ===
6161
const obj = { value: 42, writable: true };

Diff for: tests/baselines/reference/checkOtherObjectAssignProperty.types

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,80 @@
11
=== tests/cases/conformance/jsdoc/importer.js ===
22
const mod = require("./mod1");
3-
>mod : typeof import("tests/cases/conformance/jsdoc/mod1")
4-
>require("./mod1") : typeof import("tests/cases/conformance/jsdoc/mod1")
3+
>mod : typeof mod
4+
>require("./mod1") : typeof mod
55
>require : any
66
>"./mod1" : "./mod1"
77

88
mod.thing;
99
>mod.thing : number
10-
>mod : typeof import("tests/cases/conformance/jsdoc/mod1")
10+
>mod : typeof mod
1111
>thing : number
1212

1313
mod.other;
1414
>mod.other : any
15-
>mod : typeof import("tests/cases/conformance/jsdoc/mod1")
15+
>mod : typeof mod
1616
>other : any
1717

1818
mod.prop;
1919
>mod.prop : any
20-
>mod : typeof import("tests/cases/conformance/jsdoc/mod1")
20+
>mod : typeof mod
2121
>prop : any
2222

2323
mod.bad1;
2424
>mod.bad1 : any
25-
>mod : typeof import("tests/cases/conformance/jsdoc/mod1")
25+
>mod : typeof mod
2626
>bad1 : any
2727

2828
mod.bad2;
2929
>mod.bad2 : string
30-
>mod : typeof import("tests/cases/conformance/jsdoc/mod1")
30+
>mod : typeof mod
3131
>bad2 : string
3232

3333
mod.bad3;
3434
>mod.bad3 : any
35-
>mod : typeof import("tests/cases/conformance/jsdoc/mod1")
35+
>mod : typeof mod
3636
>bad3 : any
3737

3838

3939
mod.thing = 0;
4040
>mod.thing = 0 : 0
4141
>mod.thing : number
42-
>mod : typeof import("tests/cases/conformance/jsdoc/mod1")
42+
>mod : typeof mod
4343
>thing : number
4444
>0 : 0
4545

4646
mod.other = 0;
4747
>mod.other = 0 : 0
4848
>mod.other : any
49-
>mod : typeof import("tests/cases/conformance/jsdoc/mod1")
49+
>mod : typeof mod
5050
>other : any
5151
>0 : 0
5252

5353
mod.prop = 0;
5454
>mod.prop = 0 : 0
5555
>mod.prop : any
56-
>mod : typeof import("tests/cases/conformance/jsdoc/mod1")
56+
>mod : typeof mod
5757
>prop : any
5858
>0 : 0
5959

6060
mod.bad1 = 0;
6161
>mod.bad1 = 0 : 0
6262
>mod.bad1 : any
63-
>mod : typeof import("tests/cases/conformance/jsdoc/mod1")
63+
>mod : typeof mod
6464
>bad1 : any
6565
>0 : 0
6666

6767
mod.bad2 = 0;
6868
>mod.bad2 = 0 : 0
6969
>mod.bad2 : any
70-
>mod : typeof import("tests/cases/conformance/jsdoc/mod1")
70+
>mod : typeof mod
7171
>bad2 : any
7272
>0 : 0
7373

7474
mod.bad3 = 0;
7575
>mod.bad3 = 0 : 0
7676
>mod.bad3 : any
77-
>mod : typeof import("tests/cases/conformance/jsdoc/mod1")
77+
>mod : typeof mod
7878
>bad3 : any
7979
>0 : 0
8080

0 commit comments

Comments
 (0)