Skip to content

Commit 6c15fc6

Browse files
authored
Fix devtools test (microsoft#20731)
* Fix devtools test * Add small test case mimicing the issue from the user test
1 parent 60bd262 commit 6c15fc6

5 files changed

Lines changed: 89 additions & 2 deletions

File tree

src/compiler/checker.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4682,6 +4682,7 @@ namespace ts {
46824682
}
46834683
else if (isJSDocPropertyTag(declaration)
46844684
|| isPropertyAccessExpression(declaration)
4685+
|| isIdentifier(declaration)
46854686
|| isMethodDeclaration(declaration) && !isObjectLiteralMethod(declaration)) {
46864687
// TODO: Mimics old behavior from incorrect usage of getWidenedTypeForVariableLikeDeclaration, but seems incorrect
46874688
type = tryGetTypeFromEffectiveTypeNode(declaration) || anyType;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
=== tests/cases/conformance/salsa/index.js ===
2+
Common.Item = class I {}
3+
>Common : Symbol(Common, Decl(index.js, 0, 0), Decl(roots.js, 0, 3))
4+
>I : Symbol(I, Decl(index.js, 0, 13))
5+
6+
Common.Object = class extends Common.Item {}
7+
>Common : Symbol(Common, Decl(index.js, 0, 0), Decl(roots.js, 0, 3))
8+
>Common.Item : Symbol(Common.Item, Decl(index.js, 0, 0))
9+
>Common : Symbol(Common, Decl(index.js, 0, 0), Decl(roots.js, 0, 3))
10+
>Item : Symbol(Common.Item, Decl(index.js, 0, 0))
11+
12+
Workspace.Object = class extends Common.Object {}
13+
>Workspace : Symbol(Workspace, Decl(index.js, 1, 44), Decl(roots.js, 1, 3))
14+
>Common.Object : Symbol(Common.Object, Decl(index.js, 0, 24))
15+
>Common : Symbol(Common, Decl(index.js, 0, 0), Decl(roots.js, 0, 3))
16+
>Object : Symbol(Common.Object, Decl(index.js, 0, 24))
17+
18+
/** @type {Workspace.Object} */
19+
var am;
20+
>am : Symbol(am, Decl(index.js, 6, 3))
21+
22+
=== tests/cases/conformance/salsa/roots.js ===
23+
var Common = {};
24+
>Common : Symbol(Common, Decl(index.js, 0, 0), Decl(roots.js, 0, 3))
25+
26+
var Workspace = {};
27+
>Workspace : Symbol(Workspace, Decl(index.js, 1, 44), Decl(roots.js, 1, 3))
28+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
=== tests/cases/conformance/salsa/index.js ===
2+
Common.Item = class I {}
3+
>Common.Item = class I {} : typeof I
4+
>Common.Item : any
5+
>Common : any
6+
>Item : any
7+
>class I {} : typeof I
8+
>I : typeof I
9+
10+
Common.Object = class extends Common.Item {}
11+
>Common.Object = class extends Common.Item {} : typeof (Anonymous class)
12+
>Common.Object : any
13+
>Common : any
14+
>Object : any
15+
>class extends Common.Item {} : typeof (Anonymous class)
16+
>Common.Item : any
17+
>Common : any
18+
>Item : any
19+
20+
Workspace.Object = class extends Common.Object {}
21+
>Workspace.Object = class extends Common.Object {} : typeof (Anonymous class)
22+
>Workspace.Object : any
23+
>Workspace : any
24+
>Object : any
25+
>class extends Common.Object {} : typeof (Anonymous class)
26+
>Common.Object : any
27+
>Common : any
28+
>Object : any
29+
30+
/** @type {Workspace.Object} */
31+
var am;
32+
>am : (Anonymous class)
33+
34+
=== tests/cases/conformance/salsa/roots.js ===
35+
var Common = {};
36+
>Common : any
37+
>{} : { [x: string]: any; }
38+
39+
var Workspace = {};
40+
>Workspace : any
41+
>{} : { [x: string]: any; }
42+

tests/baselines/reference/user/chrome-devtools-frontend.log

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ Standard output:
1212
../../../../built/local/lib.dom.d.ts(9253,13): error TS2300: Duplicate identifier 'Request'.
1313
../../../../built/local/lib.dom.d.ts(13511,11): error TS2300: Duplicate identifier 'Window'.
1414
../../../../built/local/lib.dom.d.ts(13700,13): error TS2300: Duplicate identifier 'Window'.
15-
../../../../built/local/lib.es5.d.ts(1322,11): error TS2300: Duplicate identifier 'ArrayLike'.
16-
../../../../built/local/lib.es5.d.ts(1351,6): error TS2300: Duplicate identifier 'Record'.
15+
../../../../built/local/lib.es5.d.ts(1321,11): error TS2300: Duplicate identifier 'ArrayLike'.
16+
../../../../built/local/lib.es5.d.ts(1350,6): error TS2300: Duplicate identifier 'Record'.
1717
node_modules/chrome-devtools-frontend/front_end/Runtime.js(43,8): error TS2339: Property '_importScriptPathPrefix' does not exist on type 'Window'.
1818
node_modules/chrome-devtools-frontend/front_end/Runtime.js(95,28): error TS2339: Property 'response' does not exist on type 'EventTarget'.
1919
node_modules/chrome-devtools-frontend/front_end/Runtime.js(147,37): error TS2339: Property '_importScriptPathPrefix' does not exist on type 'Window'.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// @noEmit: true
2+
// @allowJs: true
3+
// @checkJs: true
4+
// @target: es3
5+
// @filename: index.js
6+
Common.Item = class I {}
7+
Common.Object = class extends Common.Item {}
8+
9+
Workspace.Object = class extends Common.Object {}
10+
11+
/** @type {Workspace.Object} */
12+
var am;
13+
14+
// @filename: roots.js
15+
var Common = {};
16+
var Workspace = {};

0 commit comments

Comments
 (0)