From b7e466bbb3490fccfe4b0bb98446065e4b416748 Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Mon, 16 Jul 2018 14:53:30 -0700
Subject: [PATCH 01/16] Revert "Revert "Explicitly typed special assignments
are context sensitive (#25619)""
This reverts commit 16676f27071721f846369d5a0c0edae676d41cee.
---
src/compiler/checker.ts | 14 +-
.../conflictingCommonJSES2015Exports.types | 4 +-
...ontextualTypedSpecialAssignment.errors.txt | 92 ++++++++
.../contextualTypedSpecialAssignment.symbols | 173 +++++++++++++++
.../contextualTypedSpecialAssignment.types | 208 ++++++++++++++++++
.../reference/moduleExportAlias.types | 26 +--
.../salsa/contextualTypedSpecialAssignment.ts | 84 +++++++
7 files changed, 579 insertions(+), 22 deletions(-)
create mode 100644 tests/baselines/reference/contextualTypedSpecialAssignment.errors.txt
create mode 100644 tests/baselines/reference/contextualTypedSpecialAssignment.symbols
create mode 100644 tests/baselines/reference/contextualTypedSpecialAssignment.types
create mode 100644 tests/cases/conformance/salsa/contextualTypedSpecialAssignment.ts
diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts
index e59641bed412e..cd91f4272484a 100644
--- a/src/compiler/checker.ts
+++ b/src/compiler/checker.ts
@@ -15786,22 +15786,22 @@ namespace ts {
}
// In an assignment expression, the right operand is contextually typed by the type of the left operand.
- // Don't do this for special property assignments to avoid circularity.
+ // Don't do this for special property assignments unless there is a type tag on the assignment, to avoid circularity from checking the right operand.
function isContextSensitiveAssignment(binaryExpression: BinaryExpression): boolean {
const kind = getSpecialPropertyAssignmentKind(binaryExpression);
switch (kind) {
case SpecialPropertyAssignmentKind.None:
return true;
case SpecialPropertyAssignmentKind.Property:
- // If `binaryExpression.left` was assigned a symbol, then this is a new declaration; otherwise it is an assignment to an existing declaration.
- // See `bindStaticPropertyAssignment` in `binder.ts`.
- return !binaryExpression.left.symbol;
case SpecialPropertyAssignmentKind.ExportsProperty:
- case SpecialPropertyAssignmentKind.ModuleExports:
+ case SpecialPropertyAssignmentKind.Prototype:
case SpecialPropertyAssignmentKind.PrototypeProperty:
+ // If `binaryExpression.left` was assigned a symbol, then this is a new declaration; otherwise it is an assignment to an existing declaration.
+ // See `bindStaticPropertyAssignment` in `binder.ts`.
+ return !binaryExpression.left.symbol || binaryExpression.left.symbol.valueDeclaration && !!getJSDocTypeTag(binaryExpression.left.symbol.valueDeclaration);
case SpecialPropertyAssignmentKind.ThisProperty:
- case SpecialPropertyAssignmentKind.Prototype:
- return false;
+ case SpecialPropertyAssignmentKind.ModuleExports:
+ return !binaryExpression.symbol || binaryExpression.symbol.valueDeclaration && !!getJSDocTypeTag(binaryExpression.symbol.valueDeclaration);
default:
return Debug.assertNever(kind);
}
diff --git a/tests/baselines/reference/conflictingCommonJSES2015Exports.types b/tests/baselines/reference/conflictingCommonJSES2015Exports.types
index a9dc1ce80bd7c..a6afee35f2c09 100644
--- a/tests/baselines/reference/conflictingCommonJSES2015Exports.types
+++ b/tests/baselines/reference/conflictingCommonJSES2015Exports.types
@@ -7,11 +7,11 @@ export function abc(a, b, c) { return 5; }
>5 : 5
module.exports = { abc };
->module.exports = { abc } : { [x: string]: any; abc: (a: any, b: any, c: any) => number; }
+>module.exports = { abc } : { abc: (a: any, b: any, c: any) => number; }
>module.exports : any
>module : any
>exports : any
->{ abc } : { [x: string]: any; abc: (a: any, b: any, c: any) => number; }
+>{ abc } : { abc: (a: any, b: any, c: any) => number; }
>abc : (a: any, b: any, c: any) => number
=== tests/cases/conformance/salsa/use.js ===
diff --git a/tests/baselines/reference/contextualTypedSpecialAssignment.errors.txt b/tests/baselines/reference/contextualTypedSpecialAssignment.errors.txt
new file mode 100644
index 0000000000000..e918ff187aeb6
--- /dev/null
+++ b/tests/baselines/reference/contextualTypedSpecialAssignment.errors.txt
@@ -0,0 +1,92 @@
+tests/cases/conformance/salsa/mod.js(5,7): error TS7006: Parameter 'n' implicitly has an 'any' type.
+tests/cases/conformance/salsa/test.js(52,7): error TS7006: Parameter 'n' implicitly has an 'any' type.
+tests/cases/conformance/salsa/test.js(70,7): error TS7006: Parameter 'n' implicitly has an 'any' type.
+
+
+==== tests/cases/conformance/salsa/test.js (2 errors) ====
+ /** @typedef {{
+ status: 'done'
+ m(n: number): void
+ }} DoneStatus */
+
+ // property assignment
+ var ns = {}
+ /** @type {DoneStatus} */
+ ns.x = {
+ status: 'done',
+ m(n) { }
+ }
+
+ ns.x = {
+ status: 'done',
+ m(n) { }
+ }
+ ns.x
+
+
+ // this-property assignment
+ class Thing {
+ constructor() {
+ /** @type {DoneStatus} */
+ this.s = {
+ status: 'done',
+ m(n) { }
+ }
+ }
+
+ fail() {
+ this.s = {
+ status: 'done',
+ m(n) { }
+ }
+ }
+ }
+
+ // exports-property assignment
+
+ /** @type {DoneStatus} */
+ exports.x = {
+ status: "done",
+ m(n) { }
+ }
+ exports.x
+
+ /** @type {DoneStatus} contextual typing is allowed, but module.exports.y: any.
+ Guess it doesn't check the type tag? */
+ module.exports.y = {
+ status: "done",
+ m(n) { }
+ ~
+!!! error TS7006: Parameter 'n' implicitly has an 'any' type.
+ }
+ module.exports.y
+
+ // prototype-property assignment
+ /** @type {DoneStatus} */
+ Thing.prototype.x = {
+ status: 'done',
+ m(n) { }
+ }
+ Thing.prototype.x
+
+ // prototype assignment
+ function F() {
+ }
+ /** @type {DoneStatus} */
+ F.prototype = {
+ status: "done",
+ m(n) { }
+ ~
+!!! error TS7006: Parameter 'n' implicitly has an 'any' type.
+ }
+
+==== tests/cases/conformance/salsa/mod.js (1 errors) ====
+ // module.exports assignment
+ /** @type {{ status: 'done' }} */
+ module.exports = {
+ status: "done",
+ m(n) { }
+ ~
+!!! error TS7006: Parameter 'n' implicitly has an 'any' type.
+ }
+
\ No newline at end of file
diff --git a/tests/baselines/reference/contextualTypedSpecialAssignment.symbols b/tests/baselines/reference/contextualTypedSpecialAssignment.symbols
new file mode 100644
index 0000000000000..dac01d09bcc5e
--- /dev/null
+++ b/tests/baselines/reference/contextualTypedSpecialAssignment.symbols
@@ -0,0 +1,173 @@
+=== tests/cases/conformance/salsa/test.js ===
+/** @typedef {{
+ status: 'done'
+ m(n: number): void
+}} DoneStatus */
+
+// property assignment
+var ns = {}
+>ns : Symbol(ns, Decl(test.js, 6, 3))
+
+/** @type {DoneStatus} */
+ns.x = {
+>ns.x : Symbol(ns.x, Decl(test.js, 6, 11), Decl(test.js, 11, 1))
+>ns : Symbol(ns, Decl(test.js, 6, 3))
+>x : Symbol(ns.x, Decl(test.js, 6, 11), Decl(test.js, 11, 1))
+
+ status: 'done',
+>status : Symbol(status, Decl(test.js, 8, 8))
+
+ m(n) { }
+>m : Symbol(m, Decl(test.js, 9, 19))
+>n : Symbol(n, Decl(test.js, 10, 6))
+}
+
+ns.x = {
+>ns.x : Symbol(ns.x, Decl(test.js, 6, 11), Decl(test.js, 11, 1))
+>ns : Symbol(ns, Decl(test.js, 6, 3))
+>x : Symbol(ns.x, Decl(test.js, 6, 11), Decl(test.js, 11, 1))
+
+ status: 'done',
+>status : Symbol(status, Decl(test.js, 13, 8))
+
+ m(n) { }
+>m : Symbol(m, Decl(test.js, 14, 19))
+>n : Symbol(n, Decl(test.js, 15, 6))
+}
+ns.x
+>ns.x : Symbol(ns.x, Decl(test.js, 6, 11), Decl(test.js, 11, 1))
+>ns : Symbol(ns, Decl(test.js, 6, 3))
+>x : Symbol(ns.x, Decl(test.js, 6, 11), Decl(test.js, 11, 1))
+
+
+// this-property assignment
+class Thing {
+>Thing : Symbol(Thing, Decl(test.js, 17, 4))
+
+ constructor() {
+ /** @type {DoneStatus} */
+ this.s = {
+>this.s : Symbol(Thing.s, Decl(test.js, 22, 19), Decl(test.js, 30, 12))
+>this : Symbol(Thing, Decl(test.js, 17, 4))
+>s : Symbol(Thing.s, Decl(test.js, 22, 19), Decl(test.js, 30, 12))
+
+ status: 'done',
+>status : Symbol(status, Decl(test.js, 24, 18))
+
+ m(n) { }
+>m : Symbol(m, Decl(test.js, 25, 27))
+>n : Symbol(n, Decl(test.js, 26, 14))
+ }
+ }
+
+ fail() {
+>fail : Symbol(Thing.fail, Decl(test.js, 28, 5))
+
+ this.s = {
+>this.s : Symbol(Thing.s, Decl(test.js, 22, 19), Decl(test.js, 30, 12))
+>this : Symbol(Thing, Decl(test.js, 17, 4))
+>s : Symbol(Thing.s, Decl(test.js, 22, 19), Decl(test.js, 30, 12))
+
+ status: 'done',
+>status : Symbol(status, Decl(test.js, 31, 18))
+
+ m(n) { }
+>m : Symbol(m, Decl(test.js, 32, 27))
+>n : Symbol(n, Decl(test.js, 33, 14))
+ }
+ }
+}
+
+// exports-property assignment
+
+/** @type {DoneStatus} */
+exports.x = {
+>exports.x : Symbol(x, Decl(test.js, 36, 1))
+>exports : Symbol(x, Decl(test.js, 36, 1))
+>x : Symbol(x, Decl(test.js, 36, 1))
+
+ status: "done",
+>status : Symbol(status, Decl(test.js, 41, 13))
+
+ m(n) { }
+>m : Symbol(m, Decl(test.js, 42, 19))
+>n : Symbol(n, Decl(test.js, 43, 6))
+}
+exports.x
+>exports.x : Symbol(x, Decl(test.js, 36, 1))
+>exports : Symbol("tests/cases/conformance/salsa/test", Decl(test.js, 0, 0))
+>x : Symbol(x, Decl(test.js, 36, 1))
+
+/** @type {DoneStatus} contextual typing is allowed, but module.exports.y: any.
+Guess it doesn't check the type tag? */
+module.exports.y = {
+>module.exports : Symbol(y, Decl(test.js, 45, 9))
+>module : Symbol(module)
+>y : Symbol(y, Decl(test.js, 45, 9))
+
+ status: "done",
+>status : Symbol(status, Decl(test.js, 49, 20))
+
+ m(n) { }
+>m : Symbol(m, Decl(test.js, 50, 19))
+>n : Symbol(n, Decl(test.js, 51, 6))
+}
+module.exports.y
+>module : Symbol(module)
+
+// prototype-property assignment
+/** @type {DoneStatus} */
+Thing.prototype.x = {
+>Thing.prototype.x : Symbol(Thing.x, Decl(test.js, 53, 16))
+>Thing.prototype : Symbol(Thing.x, Decl(test.js, 53, 16))
+>Thing : Symbol(Thing, Decl(test.js, 17, 4))
+>prototype : Symbol(Thing.prototype)
+>x : Symbol(Thing.x, Decl(test.js, 53, 16))
+
+ status: 'done',
+>status : Symbol(status, Decl(test.js, 57, 21))
+
+ m(n) { }
+>m : Symbol(m, Decl(test.js, 58, 19))
+>n : Symbol(n, Decl(test.js, 59, 6))
+}
+Thing.prototype.x
+>Thing.prototype.x : Symbol(Thing.x, Decl(test.js, 53, 16))
+>Thing.prototype : Symbol(Thing.prototype)
+>Thing : Symbol(Thing, Decl(test.js, 17, 4))
+>prototype : Symbol(Thing.prototype)
+>x : Symbol(Thing.x, Decl(test.js, 53, 16))
+
+// prototype assignment
+function F() {
+>F : Symbol(F, Decl(test.js, 61, 17), Decl(test.js, 65, 1))
+}
+/** @type {DoneStatus} */
+F.prototype = {
+>F.prototype : Symbol(F.prototype, Decl(test.js, 65, 1))
+>F : Symbol(F, Decl(test.js, 61, 17), Decl(test.js, 65, 1))
+>prototype : Symbol(F.prototype, Decl(test.js, 65, 1))
+
+ status: "done",
+>status : Symbol(status, Decl(test.js, 67, 15))
+
+ m(n) { }
+>m : Symbol(m, Decl(test.js, 68, 19))
+>n : Symbol(n, Decl(test.js, 69, 6))
+}
+
+=== tests/cases/conformance/salsa/mod.js ===
+// module.exports assignment
+/** @type {{ status: 'done' }} */
+module.exports = {
+>module : Symbol(export=, Decl(mod.js, 0, 0))
+>exports : Symbol(export=, Decl(mod.js, 0, 0))
+
+ status: "done",
+>status : Symbol(status, Decl(mod.js, 2, 18))
+
+ m(n) { }
+>m : Symbol(m, Decl(mod.js, 3, 19))
+>n : Symbol(n, Decl(mod.js, 4, 6))
+}
+
diff --git a/tests/baselines/reference/contextualTypedSpecialAssignment.types b/tests/baselines/reference/contextualTypedSpecialAssignment.types
new file mode 100644
index 0000000000000..04f32e7a6feb9
--- /dev/null
+++ b/tests/baselines/reference/contextualTypedSpecialAssignment.types
@@ -0,0 +1,208 @@
+=== tests/cases/conformance/salsa/test.js ===
+/** @typedef {{
+ status: 'done'
+ m(n: number): void
+}} DoneStatus */
+
+// property assignment
+var ns = {}
+>ns : { [x: string]: any; x: { status: "done"; m(n: number): void; }; }
+>{} : { [x: string]: any; }
+
+/** @type {DoneStatus} */
+ns.x = {
+>ns.x = { status: 'done', m(n) { }} : { status: "done"; m(n: number): void; }
+>ns.x : { status: "done"; m(n: number): void; }
+>ns : { [x: string]: any; x: { status: "done"; m(n: number): void; }; }
+>x : { status: "done"; m(n: number): void; }
+>{ status: 'done', m(n) { }} : { status: "done"; m(n: number): void; }
+
+ status: 'done',
+>status : "done"
+>'done' : "done"
+
+ m(n) { }
+>m : (n: number) => void
+>n : number
+}
+
+ns.x = {
+>ns.x = { status: 'done', m(n) { }} : { status: "done"; m(n: number): void; }
+>ns.x : { status: "done"; m(n: number): void; }
+>ns : { [x: string]: any; x: { status: "done"; m(n: number): void; }; }
+>x : { status: "done"; m(n: number): void; }
+>{ status: 'done', m(n) { }} : { status: "done"; m(n: number): void; }
+
+ status: 'done',
+>status : "done"
+>'done' : "done"
+
+ m(n) { }
+>m : (n: number) => void
+>n : number
+}
+ns.x
+>ns.x : { status: "done"; m(n: number): void; }
+>ns : { [x: string]: any; x: { status: "done"; m(n: number): void; }; }
+>x : { status: "done"; m(n: number): void; }
+
+
+// this-property assignment
+class Thing {
+>Thing : Thing
+
+ constructor() {
+ /** @type {DoneStatus} */
+ this.s = {
+>this.s = { status: 'done', m(n) { } } : { status: "done"; m(n: number): void; }
+>this.s : { status: "done"; m(n: number): void; }
+>this : this
+>s : { status: "done"; m(n: number): void; }
+>{ status: 'done', m(n) { } } : { status: "done"; m(n: number): void; }
+
+ status: 'done',
+>status : "done"
+>'done' : "done"
+
+ m(n) { }
+>m : (n: number) => void
+>n : number
+ }
+ }
+
+ fail() {
+>fail : () => void
+
+ this.s = {
+>this.s = { status: 'done', m(n) { } } : { status: "done"; m(n: number): void; }
+>this.s : { status: "done"; m(n: number): void; }
+>this : this
+>s : { status: "done"; m(n: number): void; }
+>{ status: 'done', m(n) { } } : { status: "done"; m(n: number): void; }
+
+ status: 'done',
+>status : "done"
+>'done' : "done"
+
+ m(n) { }
+>m : (n: number) => void
+>n : number
+ }
+ }
+}
+
+// exports-property assignment
+
+/** @type {DoneStatus} */
+exports.x = {
+>exports.x = { status: "done", m(n) { }} : { status: "done"; m(n: number): void; }
+>exports.x : { status: "done"; m(n: number): void; }
+>exports : typeof import("tests/cases/conformance/salsa/test")
+>x : { status: "done"; m(n: number): void; }
+>{ status: "done", m(n) { }} : { status: "done"; m(n: number): void; }
+
+ status: "done",
+>status : "done"
+>"done" : "done"
+
+ m(n) { }
+>m : (n: number) => void
+>n : number
+}
+exports.x
+>exports.x : { status: "done"; m(n: number): void; }
+>exports : typeof import("tests/cases/conformance/salsa/test")
+>x : { status: "done"; m(n: number): void; }
+
+/** @type {DoneStatus} contextual typing is allowed, but module.exports.y: any.
+Guess it doesn't check the type tag? */
+module.exports.y = {
+>module.exports.y = { status: "done", m(n) { }} : { status: string; m(n: any): void; }
+>module.exports.y : any
+>module.exports : any
+>module : any
+>exports : any
+>y : any
+>{ status: "done", m(n) { }} : { status: string; m(n: any): void; }
+
+ status: "done",
+>status : string
+>"done" : "done"
+
+ m(n) { }
+>m : (n: any) => void
+>n : any
+}
+module.exports.y
+>module.exports.y : any
+>module.exports : any
+>module : any
+>exports : any
+>y : any
+
+// prototype-property assignment
+/** @type {DoneStatus} */
+Thing.prototype.x = {
+>Thing.prototype.x = { status: 'done', m(n) { }} : { status: "done"; m(n: number): void; }
+>Thing.prototype.x : { status: "done"; m(n: number): void; }
+>Thing.prototype : Thing
+>Thing : typeof Thing
+>prototype : Thing
+>x : { status: "done"; m(n: number): void; }
+>{ status: 'done', m(n) { }} : { status: "done"; m(n: number): void; }
+
+ status: 'done',
+>status : "done"
+>'done' : "done"
+
+ m(n) { }
+>m : (n: number) => void
+>n : number
+}
+Thing.prototype.x
+>Thing.prototype.x : { status: "done"; m(n: number): void; }
+>Thing.prototype : Thing
+>Thing : typeof Thing
+>prototype : Thing
+>x : { status: "done"; m(n: number): void; }
+
+// prototype assignment
+function F() {
+>F : typeof F
+}
+/** @type {DoneStatus} */
+F.prototype = {
+>F.prototype = { status: "done", m(n) { }} : { status: string; m(n: any): void; }
+>F.prototype : { [x: string]: any; }
+>F : typeof F
+>prototype : { [x: string]: any; }
+>{ status: "done", m(n) { }} : { status: string; m(n: any): void; }
+
+ status: "done",
+>status : string
+>"done" : "done"
+
+ m(n) { }
+>m : (n: any) => void
+>n : any
+}
+
+=== tests/cases/conformance/salsa/mod.js ===
+// module.exports assignment
+/** @type {{ status: 'done' }} */
+module.exports = {
+>module.exports = { status: "done", m(n) { }} : { status: string; m(n: any): void; }
+>module.exports : any
+>module : any
+>exports : any
+>{ status: "done", m(n) { }} : { status: string; m(n: any): void; }
+
+ status: "done",
+>status : string
+>"done" : "done"
+
+ m(n) { }
+>m : (n: any) => void
+>n : any
+}
+
diff --git a/tests/baselines/reference/moduleExportAlias.types b/tests/baselines/reference/moduleExportAlias.types
index 924f02d7fa866..707dc90a1f5c7 100644
--- a/tests/baselines/reference/moduleExportAlias.types
+++ b/tests/baselines/reference/moduleExportAlias.types
@@ -223,19 +223,19 @@ multipleDeclarationAlias5.func9 = function () { };
>function () { } : () => void
var multipleDeclarationAlias6 = exports = module.exports = {};
->multipleDeclarationAlias6 : { [x: string]: any; }
->exports = module.exports = {} : { [x: string]: any; }
+>multipleDeclarationAlias6 : {}
+>exports = module.exports = {} : {}
>exports : typeof import("tests/cases/conformance/salsa/b")
->module.exports = {} : { [x: string]: any; }
+>module.exports = {} : {}
>module.exports : any
>module : any
>exports : any
->{} : { [x: string]: any; }
+>{} : {}
multipleDeclarationAlias6.func10 = function () { };
>multipleDeclarationAlias6.func10 = function () { } : () => void
>multipleDeclarationAlias6.func10 : any
->multipleDeclarationAlias6 : { [x: string]: any; }
+>multipleDeclarationAlias6 : {}
>func10 : any
>function () { } : () => void
@@ -294,13 +294,13 @@ module.exports.func12 = function () { };
>function () { } : () => void
exports = module.exports = {};
->exports = module.exports = {} : { [x: string]: any; }
+>exports = module.exports = {} : {}
>exports : typeof import("tests/cases/conformance/salsa/b")
->module.exports = {} : { [x: string]: any; }
+>module.exports = {} : {}
>module.exports : any
>module : any
>exports : any
->{} : { [x: string]: any; }
+>{} : {}
exports.func13 = function () { };
>exports.func13 = function () { } : () => void
@@ -319,13 +319,13 @@ module.exports.func14 = function () { };
>function () { } : () => void
exports = module.exports = {};
->exports = module.exports = {} : { [x: string]: any; }
+>exports = module.exports = {} : {}
>exports : typeof import("tests/cases/conformance/salsa/b")
->module.exports = {} : { [x: string]: any; }
+>module.exports = {} : {}
>module.exports : any
>module : any
>exports : any
->{} : { [x: string]: any; }
+>{} : {}
exports.func15 = function () { };
>exports.func15 = function () { } : () => void
@@ -369,11 +369,11 @@ module.exports.func18 = function () { };
>function () { } : () => void
module.exports = {};
->module.exports = {} : { [x: string]: any; }
+>module.exports = {} : {}
>module.exports : any
>module : any
>exports : any
->{} : { [x: string]: any; }
+>{} : {}
exports.func19 = function () { };
>exports.func19 = function () { } : () => void
diff --git a/tests/cases/conformance/salsa/contextualTypedSpecialAssignment.ts b/tests/cases/conformance/salsa/contextualTypedSpecialAssignment.ts
new file mode 100644
index 0000000000000..4b67e8b9687fc
--- /dev/null
+++ b/tests/cases/conformance/salsa/contextualTypedSpecialAssignment.ts
@@ -0,0 +1,84 @@
+// @checkJs: true
+// @allowJs: true
+// @noEmit: true
+// @Filename: test.js
+// @strict: true
+/** @typedef {{
+ status: 'done'
+ m(n: number): void
+}} DoneStatus */
+
+// property assignment
+var ns = {}
+/** @type {DoneStatus} */
+ns.x = {
+ status: 'done',
+ m(n) { }
+}
+
+ns.x = {
+ status: 'done',
+ m(n) { }
+}
+ns.x
+
+
+// this-property assignment
+class Thing {
+ constructor() {
+ /** @type {DoneStatus} */
+ this.s = {
+ status: 'done',
+ m(n) { }
+ }
+ }
+
+ fail() {
+ this.s = {
+ status: 'done',
+ m(n) { }
+ }
+ }
+}
+
+// exports-property assignment
+
+/** @type {DoneStatus} */
+exports.x = {
+ status: "done",
+ m(n) { }
+}
+exports.x
+
+/** @type {DoneStatus} contextual typing is allowed, but module.exports.y: any.
+Guess it doesn't check the type tag? */
+module.exports.y = {
+ status: "done",
+ m(n) { }
+}
+module.exports.y
+
+// prototype-property assignment
+/** @type {DoneStatus} */
+Thing.prototype.x = {
+ status: 'done',
+ m(n) { }
+}
+Thing.prototype.x
+
+// prototype assignment
+function F() {
+}
+/** @type {DoneStatus} */
+F.prototype = {
+ status: "done",
+ m(n) { }
+}
+
+// @Filename: mod.js
+// module.exports assignment
+/** @type {{ status: 'done' }} */
+module.exports = {
+ status: "done",
+ m(n) { }
+}
From 2ba6ecd4c77a912efe8cc69e09c86985da0afff8 Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Mon, 16 Jul 2018 14:53:38 -0700
Subject: [PATCH 02/16] Revert "Revert "Explicitly typed prototype assignments
are context sensitive (#25688)""
This reverts commit ff8c30d636510cd62ae654d659bd80fb7bed3324.
---
src/compiler/checker.ts | 6 +++++-
.../chainedPrototypeAssignment.types | 4 ++--
...ontextualTypedSpecialAssignment.errors.txt | 7 ++-----
.../contextualTypedSpecialAssignment.symbols | 2 +-
.../contextualTypedSpecialAssignment.types | 16 +++++++--------
.../typeFromPropertyAssignment11.types | 12 +++++------
.../typeFromPropertyAssignment13.types | 12 +++++------
.../typeFromPropertyAssignment14.types | 20 +++++++++----------
.../typeFromPropertyAssignment16.types | 20 +++++++++----------
.../typeFromPropertyAssignment27.types | 4 ++--
.../salsa/contextualTypedSpecialAssignment.ts | 2 +-
11 files changed, 53 insertions(+), 52 deletions(-)
diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts
index cd91f4272484a..944b975b2b0c5 100644
--- a/src/compiler/checker.ts
+++ b/src/compiler/checker.ts
@@ -4714,6 +4714,10 @@ namespace ts {
// function/class/{} assignments are fresh declarations, not property assignments, so only add prototype assignments
const specialDeclaration = getAssignedJavascriptInitializer(symbol.valueDeclaration);
if (specialDeclaration) {
+ const tag = getJSDocTypeTag(specialDeclaration);
+ if (tag && tag.typeExpression) {
+ return getTypeFromTypeNode(tag.typeExpression);
+ }
return getWidenedLiteralType(checkExpressionCached(specialDeclaration));
}
const types: Type[] = [];
@@ -5081,7 +5085,7 @@ namespace ts {
}
function getJSInitializerType(decl: Node, symbol: Symbol, init: Expression | undefined): Type | undefined {
- if (init && isInJavaScriptFile(init) && isObjectLiteralExpression(init)) {
+ if (init && isInJavaScriptFile(init) && isObjectLiteralExpression(init) && init.properties.length === 0) {
const exports = createSymbolTable();
while (isBinaryExpression(decl) || isPropertyAccessExpression(decl)) {
const s = getSymbolOfNode(decl);
diff --git a/tests/baselines/reference/chainedPrototypeAssignment.types b/tests/baselines/reference/chainedPrototypeAssignment.types
index f0d9cc972ef0f..a893ae63022c6 100644
--- a/tests/baselines/reference/chainedPrototypeAssignment.types
+++ b/tests/baselines/reference/chainedPrototypeAssignment.types
@@ -86,9 +86,9 @@ A.prototype = B.prototype = {
>A : typeof A
>prototype : { [x: string]: any; m(n: number): number; }
>B.prototype = { /** @param {number} n */ m(n) { return n + 1 }} : { [x: string]: any; m(n: number): number; }
->B.prototype : { [x: string]: any; }
+>B.prototype : { [x: string]: any; m(n: number): number; }
>B : typeof B
->prototype : { [x: string]: any; }
+>prototype : { [x: string]: any; m(n: number): number; }
>{ /** @param {number} n */ m(n) { return n + 1 }} : { [x: string]: any; m(n: number): number; }
/** @param {number} n */
diff --git a/tests/baselines/reference/contextualTypedSpecialAssignment.errors.txt b/tests/baselines/reference/contextualTypedSpecialAssignment.errors.txt
index e918ff187aeb6..c5851c4614711 100644
--- a/tests/baselines/reference/contextualTypedSpecialAssignment.errors.txt
+++ b/tests/baselines/reference/contextualTypedSpecialAssignment.errors.txt
@@ -1,9 +1,8 @@
tests/cases/conformance/salsa/mod.js(5,7): error TS7006: Parameter 'n' implicitly has an 'any' type.
tests/cases/conformance/salsa/test.js(52,7): error TS7006: Parameter 'n' implicitly has an 'any' type.
-tests/cases/conformance/salsa/test.js(70,7): error TS7006: Parameter 'n' implicitly has an 'any' type.
-==== tests/cases/conformance/salsa/test.js (2 errors) ====
+==== tests/cases/conformance/salsa/test.js (1 errors) ====
/** @typedef {{
status: 'done'
m(n: number): void
@@ -76,13 +75,11 @@ tests/cases/conformance/salsa/test.js(70,7): error TS7006: Parameter 'n' implici
F.prototype = {
status: "done",
m(n) { }
- ~
-!!! error TS7006: Parameter 'n' implicitly has an 'any' type.
}
==== tests/cases/conformance/salsa/mod.js (1 errors) ====
// module.exports assignment
- /** @type {{ status: 'done' }} */
+ /** @type {{ status: 'done', m(n: number): void }} */
module.exports = {
status: "done",
m(n) { }
diff --git a/tests/baselines/reference/contextualTypedSpecialAssignment.symbols b/tests/baselines/reference/contextualTypedSpecialAssignment.symbols
index dac01d09bcc5e..2a8b1650ae7bc 100644
--- a/tests/baselines/reference/contextualTypedSpecialAssignment.symbols
+++ b/tests/baselines/reference/contextualTypedSpecialAssignment.symbols
@@ -158,7 +158,7 @@ F.prototype = {
=== tests/cases/conformance/salsa/mod.js ===
// module.exports assignment
-/** @type {{ status: 'done' }} */
+/** @type {{ status: 'done', m(n: number): void }} */
module.exports = {
>module : Symbol(export=, Decl(mod.js, 0, 0))
>exports : Symbol(export=, Decl(mod.js, 0, 0))
diff --git a/tests/baselines/reference/contextualTypedSpecialAssignment.types b/tests/baselines/reference/contextualTypedSpecialAssignment.types
index 04f32e7a6feb9..5bd81e65283e4 100644
--- a/tests/baselines/reference/contextualTypedSpecialAssignment.types
+++ b/tests/baselines/reference/contextualTypedSpecialAssignment.types
@@ -172,24 +172,24 @@ function F() {
}
/** @type {DoneStatus} */
F.prototype = {
->F.prototype = { status: "done", m(n) { }} : { status: string; m(n: any): void; }
->F.prototype : { [x: string]: any; }
+>F.prototype = { status: "done", m(n) { }} : { status: "done"; m(n: number): void; }
+>F.prototype : { status: "done"; m(n: number): void; }
>F : typeof F
->prototype : { [x: string]: any; }
->{ status: "done", m(n) { }} : { status: string; m(n: any): void; }
+>prototype : { status: "done"; m(n: number): void; }
+>{ status: "done", m(n) { }} : { status: "done"; m(n: number): void; }
status: "done",
->status : string
+>status : "done"
>"done" : "done"
m(n) { }
->m : (n: any) => void
->n : any
+>m : (n: number) => void
+>n : number
}
=== tests/cases/conformance/salsa/mod.js ===
// module.exports assignment
-/** @type {{ status: 'done' }} */
+/** @type {{ status: 'done', m(n: number): void }} */
module.exports = {
>module.exports = { status: "done", m(n) { }} : { status: string; m(n: any): void; }
>module.exports : any
diff --git a/tests/baselines/reference/typeFromPropertyAssignment11.types b/tests/baselines/reference/typeFromPropertyAssignment11.types
index 87a709d7cf3a4..8c90e824f23c5 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment11.types
+++ b/tests/baselines/reference/typeFromPropertyAssignment11.types
@@ -5,9 +5,9 @@ var Inner = function() {}
Inner.prototype = {
>Inner.prototype = { m() { }, i: 1} : { [x: string]: any; m(): void; i: number; }
->Inner.prototype : { [x: string]: any; }
+>Inner.prototype : { [x: string]: any; m(): void; i: number; }
>Inner : typeof Inner
->prototype : { [x: string]: any; }
+>prototype : { [x: string]: any; m(): void; i: number; }
>{ m() { }, i: 1} : { [x: string]: any; m(): void; i: number; }
m() { },
@@ -21,18 +21,18 @@ Inner.prototype = {
Inner.prototype.j = 2
>Inner.prototype.j = 2 : 2
>Inner.prototype.j : any
->Inner.prototype : { [x: string]: any; }
+>Inner.prototype : { [x: string]: any; m(): void; i: number; }
>Inner : typeof Inner
->prototype : { [x: string]: any; }
+>prototype : { [x: string]: any; m(): void; i: number; }
>j : any
>2 : 2
/** @type {string} */
Inner.prototype.k;
>Inner.prototype.k : any
->Inner.prototype : { [x: string]: any; }
+>Inner.prototype : { [x: string]: any; m(): void; i: number; }
>Inner : typeof Inner
->prototype : { [x: string]: any; }
+>prototype : { [x: string]: any; m(): void; i: number; }
>k : any
var inner = new Inner()
diff --git a/tests/baselines/reference/typeFromPropertyAssignment13.types b/tests/baselines/reference/typeFromPropertyAssignment13.types
index 5b97d2986f57c..f85325a60a22c 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment13.types
+++ b/tests/baselines/reference/typeFromPropertyAssignment13.types
@@ -12,11 +12,11 @@ Outer.Inner = function() {}
Outer.Inner.prototype = {
>Outer.Inner.prototype = { m() { }, i: 1} : { [x: string]: any; m(): void; i: number; }
->Outer.Inner.prototype : { [x: string]: any; }
+>Outer.Inner.prototype : { [x: string]: any; m(): void; i: number; }
>Outer.Inner : typeof Inner
>Outer : typeof Outer
>Inner : typeof Inner
->prototype : { [x: string]: any; }
+>prototype : { [x: string]: any; m(): void; i: number; }
>{ m() { }, i: 1} : { [x: string]: any; m(): void; i: number; }
m() { },
@@ -30,22 +30,22 @@ Outer.Inner.prototype = {
Outer.Inner.prototype.j = 2
>Outer.Inner.prototype.j = 2 : 2
>Outer.Inner.prototype.j : any
->Outer.Inner.prototype : { [x: string]: any; }
+>Outer.Inner.prototype : { [x: string]: any; m(): void; i: number; }
>Outer.Inner : typeof Inner
>Outer : typeof Outer
>Inner : typeof Inner
->prototype : { [x: string]: any; }
+>prototype : { [x: string]: any; m(): void; i: number; }
>j : any
>2 : 2
/** @type {string} */
Outer.Inner.prototype.k;
>Outer.Inner.prototype.k : any
->Outer.Inner.prototype : { [x: string]: any; }
+>Outer.Inner.prototype : { [x: string]: any; m(): void; i: number; }
>Outer.Inner : typeof Inner
>Outer : typeof Outer
>Inner : typeof Inner
->prototype : { [x: string]: any; }
+>prototype : { [x: string]: any; m(): void; i: number; }
>k : any
var inner = new Outer.Inner()
diff --git a/tests/baselines/reference/typeFromPropertyAssignment14.types b/tests/baselines/reference/typeFromPropertyAssignment14.types
index 60d63c489d6b3..a20a5a15fc3c6 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment14.types
+++ b/tests/baselines/reference/typeFromPropertyAssignment14.types
@@ -5,19 +5,19 @@ var Outer = {};
=== tests/cases/conformance/salsa/work.js ===
Outer.Inner = function () {}
->Outer.Inner = function () {} : { (): void; prototype: { [x: string]: any; }; }
->Outer.Inner : { (): void; prototype: { [x: string]: any; }; }
+>Outer.Inner = function () {} : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
+>Outer.Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>Outer : typeof Outer
->Inner : { (): void; prototype: { [x: string]: any; }; }
->function () {} : { (): void; prototype: { [x: string]: any; }; }
+>Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
+>function () {} : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
Outer.Inner.prototype = {
>Outer.Inner.prototype = { x: 1, m() { }} : { [x: string]: any; x: number; m(): void; }
->Outer.Inner.prototype : { [x: string]: any; }
->Outer.Inner : { (): void; prototype: { [x: string]: any; }; }
+>Outer.Inner.prototype : { [x: string]: any; x: number; m(): void; }
+>Outer.Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>Outer : typeof Outer
->Inner : { (): void; prototype: { [x: string]: any; }; }
->prototype : { [x: string]: any; }
+>Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
+>prototype : { [x: string]: any; x: number; m(): void; }
>{ x: 1, m() { }} : { [x: string]: any; x: number; m(): void; }
x: 1,
@@ -47,9 +47,9 @@ inner.m()
var inno = new Outer.Inner()
>inno : { [x: string]: any; x: number; m(): void; }
>new Outer.Inner() : { [x: string]: any; x: number; m(): void; }
->Outer.Inner : { (): void; prototype: { [x: string]: any; }; }
+>Outer.Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>Outer : typeof Outer
->Inner : { (): void; prototype: { [x: string]: any; }; }
+>Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
inno.x
>inno.x : number
diff --git a/tests/baselines/reference/typeFromPropertyAssignment16.types b/tests/baselines/reference/typeFromPropertyAssignment16.types
index d67d6ccca3763..ce0ae3ae16e23 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment16.types
+++ b/tests/baselines/reference/typeFromPropertyAssignment16.types
@@ -4,19 +4,19 @@ var Outer = {};
>{} : { [x: string]: any; }
Outer.Inner = function () {}
->Outer.Inner = function () {} : { (): void; prototype: { [x: string]: any; }; }
->Outer.Inner : { (): void; prototype: { [x: string]: any; }; }
+>Outer.Inner = function () {} : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
+>Outer.Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>Outer : typeof Outer
->Inner : { (): void; prototype: { [x: string]: any; }; }
->function () {} : { (): void; prototype: { [x: string]: any; }; }
+>Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
+>function () {} : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
Outer.Inner.prototype = {
>Outer.Inner.prototype = { x: 1, m() { }} : { [x: string]: any; x: number; m(): void; }
->Outer.Inner.prototype : { [x: string]: any; }
->Outer.Inner : { (): void; prototype: { [x: string]: any; }; }
+>Outer.Inner.prototype : { [x: string]: any; x: number; m(): void; }
+>Outer.Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>Outer : typeof Outer
->Inner : { (): void; prototype: { [x: string]: any; }; }
->prototype : { [x: string]: any; }
+>Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
+>prototype : { [x: string]: any; x: number; m(): void; }
>{ x: 1, m() { }} : { [x: string]: any; x: number; m(): void; }
x: 1,
@@ -45,9 +45,9 @@ inner.m()
var inno = new Outer.Inner()
>inno : { [x: string]: any; x: number; m(): void; }
>new Outer.Inner() : { [x: string]: any; x: number; m(): void; }
->Outer.Inner : { (): void; prototype: { [x: string]: any; }; }
+>Outer.Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>Outer : typeof Outer
->Inner : { (): void; prototype: { [x: string]: any; }; }
+>Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
inno.x
>inno.x : number
diff --git a/tests/baselines/reference/typeFromPropertyAssignment27.types b/tests/baselines/reference/typeFromPropertyAssignment27.types
index 222bd04e74d14..dcaefe7a95575 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment27.types
+++ b/tests/baselines/reference/typeFromPropertyAssignment27.types
@@ -10,9 +10,9 @@ function C() { this.p = 1; }
C.prototype = { q: 2 };
>C.prototype = { q: 2 } : { [x: string]: any; q: number; }
->C.prototype : { [x: string]: any; }
+>C.prototype : { [x: string]: any; q: number; }
>C : typeof C
->prototype : { [x: string]: any; }
+>prototype : { [x: string]: any; q: number; }
>{ q: 2 } : { [x: string]: any; q: number; }
>q : number
>2 : 2
diff --git a/tests/cases/conformance/salsa/contextualTypedSpecialAssignment.ts b/tests/cases/conformance/salsa/contextualTypedSpecialAssignment.ts
index 4b67e8b9687fc..e4a2b56970c1b 100644
--- a/tests/cases/conformance/salsa/contextualTypedSpecialAssignment.ts
+++ b/tests/cases/conformance/salsa/contextualTypedSpecialAssignment.ts
@@ -77,7 +77,7 @@ F.prototype = {
// @Filename: mod.js
// module.exports assignment
-/** @type {{ status: 'done' }} */
+/** @type {{ status: 'done', m(n: number): void }} */
module.exports = {
status: "done",
m(n) { }
From 3f3708ac078163c73fccc71d021c05383fdeed47 Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Mon, 16 Jul 2018 15:01:27 -0700
Subject: [PATCH 03/16] Initial, wasteful, solution
It burns a check flags. Probably necessary, but perhaps not.
I haven't accepted baselines, but they are a bit questionable. I'm not
sure the synthetic type is right, because I expected to see
{ "exports": typeof import("x") } but instead see { "x": typeof
import("x") }.
---
src/compiler/checker.ts | 24 +++++++++++++++++-------
src/compiler/types.ts | 1 +
2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts
index 944b975b2b0c5..b798d97af0301 100644
--- a/src/compiler/checker.ts
+++ b/src/compiler/checker.ts
@@ -76,7 +76,6 @@ namespace ts {
undefinedSymbol.declarations = [];
const argumentsSymbol = createSymbol(SymbolFlags.Property, "arguments" as __String);
const requireSymbol = createSymbol(SymbolFlags.Property, "require" as __String);
- const moduleSymbol = createSymbol(SymbolFlags.Property, "module" as __String);
/** This will be set during calls to `getResolvedSignature` where services determines an apparent number of arguments greater than what is actually provided. */
let apparentArgumentCount: number | undefined;
@@ -1412,6 +1411,14 @@ namespace ts {
return lastLocation.symbol;
}
}
+ if (originalLocation && isInJavaScriptFile(originalLocation) && originalLocation.parent) {
+ if (isIdentifier(originalLocation) && isPropertyAccessExpression(originalLocation.parent) &&
+ originalLocation.escapedText === "module" && originalLocation.parent.name.escapedText === "exports") {
+ const moduleSymbol = createSymbol(SymbolFlags.FunctionScopedVariable, "module" as __String, CheckFlags.ModuleExports);
+ moduleSymbol.valueDeclaration = originalLocation;
+ return moduleSymbol;
+ }
+ }
if (!excludeGlobals) {
result = lookup(globals, name, meaning);
@@ -1422,10 +1429,6 @@ namespace ts {
if (isRequireCall(originalLocation.parent, /*checkArgumentIsStringLiteralLike*/ false)) {
return requireSymbol;
}
- if (isIdentifier(originalLocation) && isPropertyAccessExpression(originalLocation.parent) &&
- originalLocation.escapedText === "module" && originalLocation.parent.name.escapedText === "exports") {
- return moduleSymbol;
- }
}
}
if (!result) {
@@ -4984,9 +4987,15 @@ namespace ts {
return links.type = getTypeOfPrototypeProperty(symbol);
}
// CommonsJS require and module both have type any.
- if (symbol === requireSymbol || symbol === moduleSymbol) {
+ if (symbol === requireSymbol) {
return links.type = anyType;
}
+ if (getCheckFlags(symbol) & CheckFlags.ModuleExports) {
+ const fileSymbol = getSymbolOfNode(getSourceFileOfNode(symbol.valueDeclaration))
+ const members = createSymbolTable();
+ members.set("exports" as __String, fileSymbol);
+ return links.type = createAnonymousType(symbol, members, emptyArray, emptyArray, undefined, undefined);
+ }
// Handle catch clause variables
const declaration = symbol.valueDeclaration;
if (isCatchClauseVariableDeclarationOrBindingElement(declaration)) {
@@ -15010,6 +15019,7 @@ namespace ts {
let flowContainer = getControlFlowContainer(node);
const isOuterVariable = flowContainer !== declarationContainer;
const isSpreadDestructuringAssignmentTarget = node.parent && node.parent.parent && isSpreadAssignment(node.parent) && isDestructuringAssignmentTarget(node.parent.parent);
+ const isModuleExports = getCheckFlags(symbol) & CheckFlags.ModuleExports;
// When the control flow originates in a function expression or arrow function and we are referencing
// a const variable or parameter from an outer function, we extend the origin of the control flow
// analysis to include the immediately enclosing function.
@@ -15021,7 +15031,7 @@ namespace ts {
// We only look for uninitialized variables in strict null checking mode, and only when we can analyze
// the entire control flow graph from the variable's declaration (i.e. when the flow container and
// declaration container are the same).
- const assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget ||
+ const assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports ||
type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & TypeFlags.AnyOrUnknown) !== 0 ||
isInTypeQuery(node) || node.parent.kind === SyntaxKind.ExportSpecifier) ||
node.parent.kind === SyntaxKind.NonNullExpression ||
diff --git a/src/compiler/types.ts b/src/compiler/types.ts
index eb8a0c061d5c4..e76d2464aee4f 100644
--- a/src/compiler/types.ts
+++ b/src/compiler/types.ts
@@ -3526,6 +3526,7 @@ namespace ts {
ReverseMapped = 1 << 11, // Property of reverse-inferred homomorphic mapped type
OptionalParameter = 1 << 12, // Optional parameter
RestParameter = 1 << 13, // Rest parameter
+ ModuleExports = 1 << 14, // Symbol for module.exports of a file
Synthetic = SyntheticProperty | SyntheticMethod
}
From 0488063d83a0072978c527dd85d7c740543bcb63 Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Tue, 17 Jul 2018 08:06:42 -0700
Subject: [PATCH 04/16] Update some baselines
---
.../reference/callbackCrossModule.symbols | 1 +
.../reference/callbackCrossModule.types | 6 +-
.../checkJsTypeDefNoUnusedLocalMarked.symbols | 1 +
.../checkJsTypeDefNoUnusedLocalMarked.types | 6 +-
.../conflictingCommonJSES2015Exports.symbols | 2 +
.../conflictingCommonJSES2015Exports.types | 6 +-
.../reference/constructorFunctions2.symbols | 1 +
.../reference/constructorFunctions2.types | 6 +-
...ontextualTypedSpecialAssignment.errors.txt | 8 +-
.../contextualTypedSpecialAssignment.symbols | 46 ++---
.../contextualTypedSpecialAssignment.types | 39 ++--
...rtPropertyAssignmentNameResolution.symbols | 2 +
...portPropertyAssignmentNameResolution.types | 10 +-
.../javascriptCommonjsModule.symbols | 1 +
.../reference/javascriptCommonjsModule.types | 6 +-
...opertyInitalizationInObjectLiteral.symbols | 1 +
...PropertyInitalizationInObjectLiteral.types | 6 +-
.../reference/jsdocImportType.symbols | 2 +-
.../baselines/reference/jsdocImportType.types | 6 +-
.../reference/jsdocImportType2.symbols | 2 +-
.../reference/jsdocImportType2.types | 6 +-
.../jsdocTypeFromChainedAssignment2.symbols | 4 +
.../jsdocTypeFromChainedAssignment2.types | 20 +--
.../reference/moduleExportAlias.symbols | 44 +++++
.../reference/moduleExportAlias.types | 170 +++++++++---------
.../reference/moduleExportAlias3.symbols | 1 +
.../reference/moduleExportAlias3.types | 6 +-
.../reference/moduleExportAlias4.symbols | 3 +
.../reference/moduleExportAlias4.types | 16 +-
.../moduleExportNestedNamespaces.symbols | 9 +
.../moduleExportNestedNamespaces.types | 38 ++--
...rtWithExportPropertyAssignment2.errors.txt | 5 +-
...xportWithExportPropertyAssignment2.symbols | 7 +-
...eExportWithExportPropertyAssignment2.types | 16 +-
.../reference/paramTagTypeResolution.symbols | 1 +
.../reference/paramTagTypeResolution.types | 6 +-
.../typeFromPropertyAssignment17.symbols | 1 +
.../typeFromPropertyAssignment17.types | 6 +-
.../typeFromPropertyAssignment19.symbols | 1 +
.../typeFromPropertyAssignment19.types | 6 +-
.../reference/typedefCrossModule.symbols | 2 +-
.../reference/typedefCrossModule.types | 6 +-
.../reference/typedefCrossModule3.symbols | 1 +
.../reference/typedefCrossModule3.types | 6 +-
.../reference/typedefCrossModule4.symbols | 1 +
.../reference/typedefCrossModule4.types | 6 +-
.../salsa/contextualTypedSpecialAssignment.ts | 3 +-
47 files changed, 314 insertions(+), 235 deletions(-)
diff --git a/tests/baselines/reference/callbackCrossModule.symbols b/tests/baselines/reference/callbackCrossModule.symbols
index be8175c4a1157..7c094d4f93689 100644
--- a/tests/baselines/reference/callbackCrossModule.symbols
+++ b/tests/baselines/reference/callbackCrossModule.symbols
@@ -4,6 +4,7 @@
* @return {any} I don't even know what this should return
*/
module.exports = C
+>module.exports : Symbol("tests/cases/conformance/jsdoc/mod1", Decl(mod1.js, 0, 0))
>module : Symbol(export=, Decl(mod1.js, 0, 0))
>exports : Symbol(export=, Decl(mod1.js, 0, 0))
>C : Symbol(C, Decl(mod1.js, 4, 18))
diff --git a/tests/baselines/reference/callbackCrossModule.types b/tests/baselines/reference/callbackCrossModule.types
index 2f7619585b940..fe3f0ad5b1513 100644
--- a/tests/baselines/reference/callbackCrossModule.types
+++ b/tests/baselines/reference/callbackCrossModule.types
@@ -5,9 +5,9 @@
*/
module.exports = C
>module.exports = C : typeof C
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/conformance/jsdoc/mod1")
+>module : { "tests/cases/conformance/jsdoc/mod1": typeof import("tests/cases/conformance/jsdoc/mod1"); }
+>exports : typeof import("tests/cases/conformance/jsdoc/mod1")
>C : typeof C
function C() {
diff --git a/tests/baselines/reference/checkJsTypeDefNoUnusedLocalMarked.symbols b/tests/baselines/reference/checkJsTypeDefNoUnusedLocalMarked.symbols
index 6826881b83437..3385a5bb58c11 100644
--- a/tests/baselines/reference/checkJsTypeDefNoUnusedLocalMarked.symbols
+++ b/tests/baselines/reference/checkJsTypeDefNoUnusedLocalMarked.symbols
@@ -22,6 +22,7 @@ export = Foo;
/** @typedef {(foo: Foo) => string} FooFun */
module.exports = /** @type {FooFun} */(void 0);
+>module.exports : Symbol("tests/cases/compiler/something", Decl(something.js, 0, 0))
>module : Symbol(export=, Decl(something.js, 0, 0))
>exports : Symbol(export=, Decl(something.js, 0, 0))
diff --git a/tests/baselines/reference/checkJsTypeDefNoUnusedLocalMarked.types b/tests/baselines/reference/checkJsTypeDefNoUnusedLocalMarked.types
index 1428cce142b2f..aac3c50f46241 100644
--- a/tests/baselines/reference/checkJsTypeDefNoUnusedLocalMarked.types
+++ b/tests/baselines/reference/checkJsTypeDefNoUnusedLocalMarked.types
@@ -23,9 +23,9 @@ export = Foo;
module.exports = /** @type {FooFun} */(void 0);
>module.exports = /** @type {FooFun} */(void 0) : (foo: typeof Foo) => string
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/compiler/something")
+>module : { "tests/cases/compiler/something": typeof import("tests/cases/compiler/something"); }
+>exports : typeof import("tests/cases/compiler/something")
>(void 0) : (foo: typeof Foo) => string
>void 0 : undefined
>0 : 0
diff --git a/tests/baselines/reference/conflictingCommonJSES2015Exports.symbols b/tests/baselines/reference/conflictingCommonJSES2015Exports.symbols
index b022439bf31cf..1faa0f99efa71 100644
--- a/tests/baselines/reference/conflictingCommonJSES2015Exports.symbols
+++ b/tests/baselines/reference/conflictingCommonJSES2015Exports.symbols
@@ -6,7 +6,9 @@ export function abc(a, b, c) { return 5; }
>c : Symbol(c, Decl(bug24934.js, 0, 25))
module.exports = { abc };
+>module.exports : Symbol("tests/cases/conformance/salsa/bug24934", Decl(bug24934.js, 0, 0))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/bug24934", Decl(bug24934.js, 0, 0))
>abc : Symbol(abc, Decl(bug24934.js, 1, 18))
=== tests/cases/conformance/salsa/use.js ===
diff --git a/tests/baselines/reference/conflictingCommonJSES2015Exports.types b/tests/baselines/reference/conflictingCommonJSES2015Exports.types
index a6afee35f2c09..ec8ee74123bf8 100644
--- a/tests/baselines/reference/conflictingCommonJSES2015Exports.types
+++ b/tests/baselines/reference/conflictingCommonJSES2015Exports.types
@@ -8,9 +8,9 @@ export function abc(a, b, c) { return 5; }
module.exports = { abc };
>module.exports = { abc } : { abc: (a: any, b: any, c: any) => number; }
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/conformance/salsa/bug24934")
+>module : { "tests/cases/conformance/salsa/bug24934": typeof import("tests/cases/conformance/salsa/bug24934"); }
+>exports : typeof import("tests/cases/conformance/salsa/bug24934")
>{ abc } : { abc: (a: any, b: any, c: any) => number; }
>abc : (a: any, b: any, c: any) => number
diff --git a/tests/baselines/reference/constructorFunctions2.symbols b/tests/baselines/reference/constructorFunctions2.symbols
index a01826b1c9994..033a428e6e593 100644
--- a/tests/baselines/reference/constructorFunctions2.symbols
+++ b/tests/baselines/reference/constructorFunctions2.symbols
@@ -52,6 +52,7 @@ function A() { this.id = 1; }
>id : Symbol(A.id, Decl(other.js, 0, 14))
module.exports = A;
+>module.exports : Symbol("tests/cases/conformance/salsa/other", Decl(other.js, 0, 0))
>module : Symbol(export=, Decl(other.js, 0, 29))
>exports : Symbol(export=, Decl(other.js, 0, 29))
>A : Symbol(A, Decl(other.js, 0, 0))
diff --git a/tests/baselines/reference/constructorFunctions2.types b/tests/baselines/reference/constructorFunctions2.types
index c5c59c25dbabc..ca54eb838ddee 100644
--- a/tests/baselines/reference/constructorFunctions2.types
+++ b/tests/baselines/reference/constructorFunctions2.types
@@ -70,8 +70,8 @@ function A() { this.id = 1; }
module.exports = A;
>module.exports = A : typeof A
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/conformance/salsa/other")
+>module : { "tests/cases/conformance/salsa/other": typeof import("tests/cases/conformance/salsa/other"); }
+>exports : typeof import("tests/cases/conformance/salsa/other")
>A : typeof A
diff --git a/tests/baselines/reference/contextualTypedSpecialAssignment.errors.txt b/tests/baselines/reference/contextualTypedSpecialAssignment.errors.txt
index c5851c4614711..1c745e2dac563 100644
--- a/tests/baselines/reference/contextualTypedSpecialAssignment.errors.txt
+++ b/tests/baselines/reference/contextualTypedSpecialAssignment.errors.txt
@@ -1,8 +1,7 @@
tests/cases/conformance/salsa/mod.js(5,7): error TS7006: Parameter 'n' implicitly has an 'any' type.
-tests/cases/conformance/salsa/test.js(52,7): error TS7006: Parameter 'n' implicitly has an 'any' type.
-==== tests/cases/conformance/salsa/test.js (1 errors) ====
+==== tests/cases/conformance/salsa/test.js (0 errors) ====
/** @typedef {{
status: 'done'
m(n: number): void
@@ -50,13 +49,10 @@ tests/cases/conformance/salsa/test.js(52,7): error TS7006: Parameter 'n' implici
}
exports.x
- /** @type {DoneStatus} contextual typing is allowed, but module.exports.y: any.
- Guess it doesn't check the type tag? */
+ /** @type {DoneStatus} */
module.exports.y = {
status: "done",
m(n) { }
- ~
-!!! error TS7006: Parameter 'n' implicitly has an 'any' type.
}
module.exports.y
diff --git a/tests/baselines/reference/contextualTypedSpecialAssignment.symbols b/tests/baselines/reference/contextualTypedSpecialAssignment.symbols
index 2a8b1650ae7bc..9adaea7c2f008 100644
--- a/tests/baselines/reference/contextualTypedSpecialAssignment.symbols
+++ b/tests/baselines/reference/contextualTypedSpecialAssignment.symbols
@@ -98,68 +98,74 @@ exports.x
>exports : Symbol("tests/cases/conformance/salsa/test", Decl(test.js, 0, 0))
>x : Symbol(x, Decl(test.js, 36, 1))
-/** @type {DoneStatus} contextual typing is allowed, but module.exports.y: any.
-Guess it doesn't check the type tag? */
+/** @type {DoneStatus} */
module.exports.y = {
+>module.exports.y : Symbol(y, Decl(test.js, 45, 9))
>module.exports : Symbol(y, Decl(test.js, 45, 9))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/test", Decl(test.js, 0, 0))
>y : Symbol(y, Decl(test.js, 45, 9))
status: "done",
->status : Symbol(status, Decl(test.js, 49, 20))
+>status : Symbol(status, Decl(test.js, 48, 20))
m(n) { }
->m : Symbol(m, Decl(test.js, 50, 19))
->n : Symbol(n, Decl(test.js, 51, 6))
+>m : Symbol(m, Decl(test.js, 49, 19))
+>n : Symbol(n, Decl(test.js, 50, 6))
}
module.exports.y
+>module.exports.y : Symbol(y, Decl(test.js, 45, 9))
+>module.exports : Symbol("tests/cases/conformance/salsa/test", Decl(test.js, 0, 0))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/test", Decl(test.js, 0, 0))
+>y : Symbol(y, Decl(test.js, 45, 9))
// prototype-property assignment
/** @type {DoneStatus} */
Thing.prototype.x = {
->Thing.prototype.x : Symbol(Thing.x, Decl(test.js, 53, 16))
->Thing.prototype : Symbol(Thing.x, Decl(test.js, 53, 16))
+>Thing.prototype.x : Symbol(Thing.x, Decl(test.js, 52, 16))
+>Thing.prototype : Symbol(Thing.x, Decl(test.js, 52, 16))
>Thing : Symbol(Thing, Decl(test.js, 17, 4))
>prototype : Symbol(Thing.prototype)
->x : Symbol(Thing.x, Decl(test.js, 53, 16))
+>x : Symbol(Thing.x, Decl(test.js, 52, 16))
status: 'done',
->status : Symbol(status, Decl(test.js, 57, 21))
+>status : Symbol(status, Decl(test.js, 56, 21))
m(n) { }
->m : Symbol(m, Decl(test.js, 58, 19))
->n : Symbol(n, Decl(test.js, 59, 6))
+>m : Symbol(m, Decl(test.js, 57, 19))
+>n : Symbol(n, Decl(test.js, 58, 6))
}
Thing.prototype.x
->Thing.prototype.x : Symbol(Thing.x, Decl(test.js, 53, 16))
+>Thing.prototype.x : Symbol(Thing.x, Decl(test.js, 52, 16))
>Thing.prototype : Symbol(Thing.prototype)
>Thing : Symbol(Thing, Decl(test.js, 17, 4))
>prototype : Symbol(Thing.prototype)
->x : Symbol(Thing.x, Decl(test.js, 53, 16))
+>x : Symbol(Thing.x, Decl(test.js, 52, 16))
// prototype assignment
function F() {
->F : Symbol(F, Decl(test.js, 61, 17), Decl(test.js, 65, 1))
+>F : Symbol(F, Decl(test.js, 60, 17), Decl(test.js, 64, 1))
}
/** @type {DoneStatus} */
F.prototype = {
->F.prototype : Symbol(F.prototype, Decl(test.js, 65, 1))
->F : Symbol(F, Decl(test.js, 61, 17), Decl(test.js, 65, 1))
->prototype : Symbol(F.prototype, Decl(test.js, 65, 1))
+>F.prototype : Symbol(F.prototype, Decl(test.js, 64, 1))
+>F : Symbol(F, Decl(test.js, 60, 17), Decl(test.js, 64, 1))
+>prototype : Symbol(F.prototype, Decl(test.js, 64, 1))
status: "done",
->status : Symbol(status, Decl(test.js, 67, 15))
+>status : Symbol(status, Decl(test.js, 66, 15))
m(n) { }
->m : Symbol(m, Decl(test.js, 68, 19))
->n : Symbol(n, Decl(test.js, 69, 6))
+>m : Symbol(m, Decl(test.js, 67, 19))
+>n : Symbol(n, Decl(test.js, 68, 6))
}
=== tests/cases/conformance/salsa/mod.js ===
// module.exports assignment
/** @type {{ status: 'done', m(n: number): void }} */
module.exports = {
+>module.exports : Symbol("tests/cases/conformance/salsa/mod", Decl(mod.js, 0, 0))
>module : Symbol(export=, Decl(mod.js, 0, 0))
>exports : Symbol(export=, Decl(mod.js, 0, 0))
diff --git a/tests/baselines/reference/contextualTypedSpecialAssignment.types b/tests/baselines/reference/contextualTypedSpecialAssignment.types
index 5bd81e65283e4..5864f262c7e4e 100644
--- a/tests/baselines/reference/contextualTypedSpecialAssignment.types
+++ b/tests/baselines/reference/contextualTypedSpecialAssignment.types
@@ -114,31 +114,30 @@ exports.x
>exports : typeof import("tests/cases/conformance/salsa/test")
>x : { status: "done"; m(n: number): void; }
-/** @type {DoneStatus} contextual typing is allowed, but module.exports.y: any.
-Guess it doesn't check the type tag? */
+/** @type {DoneStatus} */
module.exports.y = {
->module.exports.y = { status: "done", m(n) { }} : { status: string; m(n: any): void; }
->module.exports.y : any
->module.exports : any
->module : any
->exports : any
->y : any
->{ status: "done", m(n) { }} : { status: string; m(n: any): void; }
+>module.exports.y = { status: "done", m(n) { }} : { status: "done"; m(n: number): void; }
+>module.exports.y : { status: "done"; m(n: number): void; }
+>module.exports : typeof import("tests/cases/conformance/salsa/test")
+>module : { "tests/cases/conformance/salsa/test": typeof import("tests/cases/conformance/salsa/test"); }
+>exports : typeof import("tests/cases/conformance/salsa/test")
+>y : { status: "done"; m(n: number): void; }
+>{ status: "done", m(n) { }} : { status: "done"; m(n: number): void; }
status: "done",
->status : string
+>status : "done"
>"done" : "done"
m(n) { }
->m : (n: any) => void
->n : any
+>m : (n: number) => void
+>n : number
}
module.exports.y
->module.exports.y : any
->module.exports : any
->module : any
->exports : any
->y : any
+>module.exports.y : { status: "done"; m(n: number): void; }
+>module.exports : typeof import("tests/cases/conformance/salsa/test")
+>module : { "tests/cases/conformance/salsa/test": typeof import("tests/cases/conformance/salsa/test"); }
+>exports : typeof import("tests/cases/conformance/salsa/test")
+>y : { status: "done"; m(n: number): void; }
// prototype-property assignment
/** @type {DoneStatus} */
@@ -192,9 +191,9 @@ F.prototype = {
/** @type {{ status: 'done', m(n: number): void }} */
module.exports = {
>module.exports = { status: "done", m(n) { }} : { status: string; m(n: any): void; }
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/conformance/salsa/mod")
+>module : { "tests/cases/conformance/salsa/mod": typeof import("tests/cases/conformance/salsa/mod"); }
+>exports : typeof import("tests/cases/conformance/salsa/mod")
>{ status: "done", m(n) { }} : { status: string; m(n: any): void; }
status: "done",
diff --git a/tests/baselines/reference/exportPropertyAssignmentNameResolution.symbols b/tests/baselines/reference/exportPropertyAssignmentNameResolution.symbols
index e7da3bfc2b4ea..ae77892de5203 100644
--- a/tests/baselines/reference/exportPropertyAssignmentNameResolution.symbols
+++ b/tests/baselines/reference/exportPropertyAssignmentNameResolution.symbols
@@ -1,7 +1,9 @@
=== tests/cases/conformance/salsa/bug24492.js ===
module.exports.D = class { }
+>module.exports.D : Symbol(D, Decl(bug24492.js, 0, 0))
>module.exports : Symbol(D, Decl(bug24492.js, 0, 0))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/bug24492", Decl(bug24492.js, 0, 0))
>D : Symbol(D, Decl(bug24492.js, 0, 0))
new D()
diff --git a/tests/baselines/reference/exportPropertyAssignmentNameResolution.types b/tests/baselines/reference/exportPropertyAssignmentNameResolution.types
index 24553ae18c5d1..0cd1490c88611 100644
--- a/tests/baselines/reference/exportPropertyAssignmentNameResolution.types
+++ b/tests/baselines/reference/exportPropertyAssignmentNameResolution.types
@@ -1,11 +1,11 @@
=== tests/cases/conformance/salsa/bug24492.js ===
module.exports.D = class { }
>module.exports.D = class { } : typeof D
->module.exports.D : any
->module.exports : any
->module : any
->exports : any
->D : any
+>module.exports.D : typeof D
+>module.exports : typeof import("tests/cases/conformance/salsa/bug24492")
+>module : { "tests/cases/conformance/salsa/bug24492": typeof import("tests/cases/conformance/salsa/bug24492"); }
+>exports : typeof import("tests/cases/conformance/salsa/bug24492")
+>D : typeof D
>class { } : typeof D
new D()
diff --git a/tests/baselines/reference/javascriptCommonjsModule.symbols b/tests/baselines/reference/javascriptCommonjsModule.symbols
index 923e0b3467b9f..da5d60593f4c9 100644
--- a/tests/baselines/reference/javascriptCommonjsModule.symbols
+++ b/tests/baselines/reference/javascriptCommonjsModule.symbols
@@ -7,6 +7,7 @@ class Bar extends Foo {}
>Foo : Symbol(Foo, Decl(index.js, 0, 0))
module.exports = Bar;
+>module.exports : Symbol("tests/cases/compiler/index", Decl(index.js, 0, 0))
>module : Symbol(export=, Decl(index.js, 2, 24))
>exports : Symbol(export=, Decl(index.js, 2, 24))
>Bar : Symbol(Bar, Decl(index.js, 0, 12))
diff --git a/tests/baselines/reference/javascriptCommonjsModule.types b/tests/baselines/reference/javascriptCommonjsModule.types
index 88126ce473727..c71fbdd12a254 100644
--- a/tests/baselines/reference/javascriptCommonjsModule.types
+++ b/tests/baselines/reference/javascriptCommonjsModule.types
@@ -8,8 +8,8 @@ class Bar extends Foo {}
module.exports = Bar;
>module.exports = Bar : typeof Bar
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/compiler/index")
+>module : { "tests/cases/compiler/index": typeof import("tests/cases/compiler/index"); }
+>exports : typeof import("tests/cases/compiler/index")
>Bar : typeof Bar
diff --git a/tests/baselines/reference/jsFileClassPropertyInitalizationInObjectLiteral.symbols b/tests/baselines/reference/jsFileClassPropertyInitalizationInObjectLiteral.symbols
index 6cb2e235ce2cd..3b1f9b780f996 100644
--- a/tests/baselines/reference/jsFileClassPropertyInitalizationInObjectLiteral.symbols
+++ b/tests/baselines/reference/jsFileClassPropertyInitalizationInObjectLiteral.symbols
@@ -1,5 +1,6 @@
=== tests/cases/compiler/foo.js ===
module.exports = function () {
+>module.exports : Symbol("tests/cases/compiler/foo", Decl(foo.js, 0, 0))
>module : Symbol(export=, Decl(foo.js, 0, 0))
>exports : Symbol(export=, Decl(foo.js, 0, 0))
diff --git a/tests/baselines/reference/jsFileClassPropertyInitalizationInObjectLiteral.types b/tests/baselines/reference/jsFileClassPropertyInitalizationInObjectLiteral.types
index fc1fad7f8611b..b2fae64521151 100644
--- a/tests/baselines/reference/jsFileClassPropertyInitalizationInObjectLiteral.types
+++ b/tests/baselines/reference/jsFileClassPropertyInitalizationInObjectLiteral.types
@@ -1,9 +1,9 @@
=== tests/cases/compiler/foo.js ===
module.exports = function () {
>module.exports = function () { class A { } return { c: A.b = 1, }} : () => { [x: string]: any; c: number; }
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/compiler/foo")
+>module : { "tests/cases/compiler/foo": typeof import("tests/cases/compiler/foo"); }
+>exports : typeof import("tests/cases/compiler/foo")
>function () { class A { } return { c: A.b = 1, }} : () => { [x: string]: any; c: number; }
class A { }
diff --git a/tests/baselines/reference/jsdocImportType.symbols b/tests/baselines/reference/jsdocImportType.symbols
index 657ad6801f1cc..dbe46e966e315 100644
--- a/tests/baselines/reference/jsdocImportType.symbols
+++ b/tests/baselines/reference/jsdocImportType.symbols
@@ -49,7 +49,7 @@ class Chunk {
}
}
module.exports = Chunk;
->module.exports : Symbol(exports, Decl(types.d.ts, 2, 21))
+>module.exports : Symbol("tests/cases/conformance/jsdoc/mod1", Decl(mod1.js, 0, 0))
>module : Symbol(export=, Decl(mod1.js, 5, 1))
>exports : Symbol(export=, Decl(mod1.js, 5, 1))
>Chunk : Symbol(Chunk, Decl(mod1.js, 0, 0))
diff --git a/tests/baselines/reference/jsdocImportType.types b/tests/baselines/reference/jsdocImportType.types
index b2ac2764cd584..b332f7c9bcdcb 100644
--- a/tests/baselines/reference/jsdocImportType.types
+++ b/tests/baselines/reference/jsdocImportType.types
@@ -53,8 +53,8 @@ class Chunk {
}
module.exports = Chunk;
>module.exports = Chunk : typeof Chunk
->module.exports : any
->module : { exports: any; }
->exports : any
+>module.exports : typeof import("tests/cases/conformance/jsdoc/mod1")
+>module : { "tests/cases/conformance/jsdoc/mod1": typeof import("tests/cases/conformance/jsdoc/mod1"); }
+>exports : typeof import("tests/cases/conformance/jsdoc/mod1")
>Chunk : typeof Chunk
diff --git a/tests/baselines/reference/jsdocImportType2.symbols b/tests/baselines/reference/jsdocImportType2.symbols
index e67d250ca3d60..a7ed5cc3d41c5 100644
--- a/tests/baselines/reference/jsdocImportType2.symbols
+++ b/tests/baselines/reference/jsdocImportType2.symbols
@@ -39,7 +39,7 @@ declare var module: { exports: any };
=== tests/cases/conformance/jsdoc/mod1.js ===
///
module.exports = class Chunk {
->module.exports : Symbol(exports, Decl(types.d.ts, 2, 21))
+>module.exports : Symbol("tests/cases/conformance/jsdoc/mod1", Decl(mod1.js, 0, 0))
>module : Symbol(export=, Decl(mod1.js, 0, 0))
>exports : Symbol(export=, Decl(mod1.js, 0, 0))
>Chunk : Symbol(Chunk, Decl(mod1.js, 1, 16))
diff --git a/tests/baselines/reference/jsdocImportType2.types b/tests/baselines/reference/jsdocImportType2.types
index c0dfb2d925a24..a5b22208a77dc 100644
--- a/tests/baselines/reference/jsdocImportType2.types
+++ b/tests/baselines/reference/jsdocImportType2.types
@@ -41,9 +41,9 @@ declare var module: { exports: any };
///
module.exports = class Chunk {
>module.exports = class Chunk { constructor() { this.chunk = 1; }} : typeof Chunk
->module.exports : any
->module : { exports: any; }
->exports : any
+>module.exports : typeof import("tests/cases/conformance/jsdoc/mod1")
+>module : { "tests/cases/conformance/jsdoc/mod1": typeof import("tests/cases/conformance/jsdoc/mod1"); }
+>exports : typeof import("tests/cases/conformance/jsdoc/mod1")
>class Chunk { constructor() { this.chunk = 1; }} : typeof Chunk
>Chunk : typeof Chunk
diff --git a/tests/baselines/reference/jsdocTypeFromChainedAssignment2.symbols b/tests/baselines/reference/jsdocTypeFromChainedAssignment2.symbols
index b85eafa6925e3..4b29fbc1f6161 100644
--- a/tests/baselines/reference/jsdocTypeFromChainedAssignment2.symbols
+++ b/tests/baselines/reference/jsdocTypeFromChainedAssignment2.symbols
@@ -41,11 +41,15 @@ exports.f = exports.g = function fg(n) {
}
/** @param {string} mom */
module.exports.h = module.exports.i = function hi(mom) {
+>module.exports.h : Symbol(h, Decl(mod.js, 3, 1))
>module.exports : Symbol(h, Decl(mod.js, 3, 1))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/jsdoc/mod", Decl(mod.js, 0, 0))
>h : Symbol(h, Decl(mod.js, 3, 1))
+>module.exports.i : Symbol(i, Decl(mod.js, 5, 18))
>module.exports : Symbol(i, Decl(mod.js, 5, 18))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/jsdoc/mod", Decl(mod.js, 0, 0))
>i : Symbol(i, Decl(mod.js, 5, 18))
>hi : Symbol(hi, Decl(mod.js, 5, 37))
>mom : Symbol(mom, Decl(mod.js, 5, 50))
diff --git a/tests/baselines/reference/jsdocTypeFromChainedAssignment2.types b/tests/baselines/reference/jsdocTypeFromChainedAssignment2.types
index de2a38cce7981..a236e922e9fab 100644
--- a/tests/baselines/reference/jsdocTypeFromChainedAssignment2.types
+++ b/tests/baselines/reference/jsdocTypeFromChainedAssignment2.types
@@ -56,17 +56,17 @@ exports.f = exports.g = function fg(n) {
/** @param {string} mom */
module.exports.h = module.exports.i = function hi(mom) {
>module.exports.h = module.exports.i = function hi(mom) { return `hi, ${mom}!`;} : (mom: string) => string
->module.exports.h : any
->module.exports : any
->module : any
->exports : any
->h : any
+>module.exports.h : (mom: string) => string
+>module.exports : typeof import("tests/cases/conformance/jsdoc/mod")
+>module : { "tests/cases/conformance/jsdoc/mod": typeof import("tests/cases/conformance/jsdoc/mod"); }
+>exports : typeof import("tests/cases/conformance/jsdoc/mod")
+>h : (mom: string) => string
>module.exports.i = function hi(mom) { return `hi, ${mom}!`;} : (mom: string) => string
->module.exports.i : any
->module.exports : any
->module : any
->exports : any
->i : any
+>module.exports.i : (mom: string) => string
+>module.exports : typeof import("tests/cases/conformance/jsdoc/mod")
+>module : { "tests/cases/conformance/jsdoc/mod": typeof import("tests/cases/conformance/jsdoc/mod"); }
+>exports : typeof import("tests/cases/conformance/jsdoc/mod")
+>i : (mom: string) => string
>function hi(mom) { return `hi, ${mom}!`;} : (mom: string) => string
>hi : (mom: string) => string
>mom : string
diff --git a/tests/baselines/reference/moduleExportAlias.symbols b/tests/baselines/reference/moduleExportAlias.symbols
index 7d17348aa881c..268bd484ca07b 100644
--- a/tests/baselines/reference/moduleExportAlias.symbols
+++ b/tests/baselines/reference/moduleExportAlias.symbols
@@ -120,28 +120,40 @@ exports.func2 = function () { };
var moduleExportsAlias = module.exports;
>moduleExportsAlias : Symbol(moduleExportsAlias, Decl(b.js, 4, 3))
+>module.exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
moduleExportsAlias.func3 = function () { };
+>moduleExportsAlias.func3 : Symbol(func3, Decl(b.js, 4, 40))
>moduleExportsAlias : Symbol(moduleExportsAlias, Decl(b.js, 4, 3))
+>func3 : Symbol(func3, Decl(b.js, 4, 40))
module.exports.func4 = function () { };
+>module.exports.func4 : Symbol(func4, Decl(b.js, 5, 43))
>module.exports : Symbol(func4, Decl(b.js, 5, 43))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
>func4 : Symbol(func4, Decl(b.js, 5, 43))
var multipleDeclarationAlias1 = exports = module.exports;
>multipleDeclarationAlias1 : Symbol(multipleDeclarationAlias1, Decl(b.js, 8, 3))
>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
+>module.exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
multipleDeclarationAlias1.func5 = function () { };
+>multipleDeclarationAlias1.func5 : Symbol(func5, Decl(b.js, 8, 57))
>multipleDeclarationAlias1 : Symbol(multipleDeclarationAlias1, Decl(b.js, 8, 3))
+>func5 : Symbol(func5, Decl(b.js, 8, 57))
var multipleDeclarationAlias2 = module.exports = exports;
>multipleDeclarationAlias2 : Symbol(multipleDeclarationAlias2, Decl(b.js, 11, 3))
+>module.exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
>module : Symbol(module)
>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
+>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
multipleDeclarationAlias2.func6 = function () { };
>multipleDeclarationAlias2.func6 : Symbol(func6, Decl(b.js, 11, 57))
@@ -164,15 +176,21 @@ multipleDeclarationAlias3.func7 = function () { };
var multipleDeclarationAlias4 = someOtherVariable = module.exports;
>multipleDeclarationAlias4 : Symbol(multipleDeclarationAlias4, Decl(b.js, 18, 3))
>someOtherVariable : Symbol(someOtherVariable, Decl(b.js, 14, 3))
+>module.exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
multipleDeclarationAlias4.func8 = function () { };
+>multipleDeclarationAlias4.func8 : Symbol(func8, Decl(b.js, 18, 67))
>multipleDeclarationAlias4 : Symbol(multipleDeclarationAlias4, Decl(b.js, 18, 3))
+>func8 : Symbol(func8, Decl(b.js, 18, 67))
var multipleDeclarationAlias5 = module.exports = exports = {};
>multipleDeclarationAlias5 : Symbol(multipleDeclarationAlias5, Decl(b.js, 21, 3))
+>module.exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
>module : Symbol(module)
>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
+>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
multipleDeclarationAlias5.func9 = function () { };
>multipleDeclarationAlias5 : Symbol(multipleDeclarationAlias5, Decl(b.js, 21, 3))
@@ -180,14 +198,18 @@ multipleDeclarationAlias5.func9 = function () { };
var multipleDeclarationAlias6 = exports = module.exports = {};
>multipleDeclarationAlias6 : Symbol(multipleDeclarationAlias6, Decl(b.js, 24, 3))
>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
+>module.exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
multipleDeclarationAlias6.func10 = function () { };
>multipleDeclarationAlias6 : Symbol(multipleDeclarationAlias6, Decl(b.js, 24, 3))
exports = module.exports = someOtherVariable = {};
>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
+>module.exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
>someOtherVariable : Symbol(someOtherVariable, Decl(b.js, 14, 3))
exports.func11 = function () { };
@@ -196,13 +218,17 @@ exports.func11 = function () { };
>func11 : Symbol(func11, Decl(b.js, 27, 50), Decl(b.js, 31, 50))
module.exports.func12 = function () { };
+>module.exports.func12 : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33))
>module.exports : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
>func12 : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33))
exports = module.exports = someOtherVariable = {};
>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
+>module.exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
>someOtherVariable : Symbol(someOtherVariable, Decl(b.js, 14, 3))
exports.func11 = function () { };
@@ -211,13 +237,17 @@ exports.func11 = function () { };
>func11 : Symbol(func11, Decl(b.js, 27, 50), Decl(b.js, 31, 50))
module.exports.func12 = function () { };
+>module.exports.func12 : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33))
>module.exports : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
>func12 : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33))
exports = module.exports = {};
>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
+>module.exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
exports.func13 = function () { };
>exports.func13 : Symbol(func13, Decl(b.js, 35, 30))
@@ -225,13 +255,17 @@ exports.func13 = function () { };
>func13 : Symbol(func13, Decl(b.js, 35, 30))
module.exports.func14 = function () { };
+>module.exports.func14 : Symbol(func14, Decl(b.js, 36, 33))
>module.exports : Symbol(func14, Decl(b.js, 36, 33))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
>func14 : Symbol(func14, Decl(b.js, 36, 33))
exports = module.exports = {};
>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
+>module.exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
exports.func15 = function () { };
>exports.func15 : Symbol(func15, Decl(b.js, 39, 30))
@@ -239,13 +273,17 @@ exports.func15 = function () { };
>func15 : Symbol(func15, Decl(b.js, 39, 30))
module.exports.func16 = function () { };
+>module.exports.func16 : Symbol(func16, Decl(b.js, 40, 33))
>module.exports : Symbol(func16, Decl(b.js, 40, 33))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
>func16 : Symbol(func16, Decl(b.js, 40, 33))
module.exports = exports = {};
+>module.exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
>module : Symbol(module)
>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
+>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
exports.func17 = function () { };
>exports.func17 : Symbol(func17, Decl(b.js, 43, 30))
@@ -253,12 +291,16 @@ exports.func17 = function () { };
>func17 : Symbol(func17, Decl(b.js, 43, 30))
module.exports.func18 = function () { };
+>module.exports.func18 : Symbol(func18, Decl(b.js, 44, 33))
>module.exports : Symbol(func18, Decl(b.js, 44, 33))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
>func18 : Symbol(func18, Decl(b.js, 44, 33))
module.exports = {};
+>module.exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
exports.func19 = function () { };
>exports.func19 : Symbol(func19, Decl(b.js, 47, 20))
@@ -266,8 +308,10 @@ exports.func19 = function () { };
>func19 : Symbol(func19, Decl(b.js, 47, 20))
module.exports.func20 = function () { };
+>module.exports.func20 : Symbol(func20, Decl(b.js, 48, 33))
>module.exports : Symbol(func20, Decl(b.js, 48, 33))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
>func20 : Symbol(func20, Decl(b.js, 48, 33))
diff --git a/tests/baselines/reference/moduleExportAlias.types b/tests/baselines/reference/moduleExportAlias.types
index 707dc90a1f5c7..39eb75f912aa5 100644
--- a/tests/baselines/reference/moduleExportAlias.types
+++ b/tests/baselines/reference/moduleExportAlias.types
@@ -123,48 +123,48 @@ exports.func2 = function () { };
>function () { } : () => void
var moduleExportsAlias = module.exports;
->moduleExportsAlias : any
->module.exports : any
->module : any
->exports : any
+>moduleExportsAlias : typeof import("tests/cases/conformance/salsa/b")
+>module.exports : typeof import("tests/cases/conformance/salsa/b")
+>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
+>exports : typeof import("tests/cases/conformance/salsa/b")
moduleExportsAlias.func3 = function () { };
>moduleExportsAlias.func3 = function () { } : () => void
->moduleExportsAlias.func3 : any
->moduleExportsAlias : any
->func3 : any
+>moduleExportsAlias.func3 : () => void
+>moduleExportsAlias : typeof import("tests/cases/conformance/salsa/b")
+>func3 : () => void
>function () { } : () => void
module.exports.func4 = function () { };
>module.exports.func4 = function () { } : () => void
->module.exports.func4 : any
->module.exports : any
->module : any
->exports : any
->func4 : any
+>module.exports.func4 : () => void
+>module.exports : typeof import("tests/cases/conformance/salsa/b")
+>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
+>exports : typeof import("tests/cases/conformance/salsa/b")
+>func4 : () => void
>function () { } : () => void
var multipleDeclarationAlias1 = exports = module.exports;
->multipleDeclarationAlias1 : any
->exports = module.exports : any
+>multipleDeclarationAlias1 : typeof import("tests/cases/conformance/salsa/b")
+>exports = module.exports : typeof import("tests/cases/conformance/salsa/b")
+>exports : typeof import("tests/cases/conformance/salsa/b")
+>module.exports : typeof import("tests/cases/conformance/salsa/b")
+>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
>exports : typeof import("tests/cases/conformance/salsa/b")
->module.exports : any
->module : any
->exports : any
multipleDeclarationAlias1.func5 = function () { };
>multipleDeclarationAlias1.func5 = function () { } : () => void
->multipleDeclarationAlias1.func5 : any
->multipleDeclarationAlias1 : any
->func5 : any
+>multipleDeclarationAlias1.func5 : () => void
+>multipleDeclarationAlias1 : typeof import("tests/cases/conformance/salsa/b")
+>func5 : () => void
>function () { } : () => void
var multipleDeclarationAlias2 = module.exports = exports;
>multipleDeclarationAlias2 : typeof import("tests/cases/conformance/salsa/b")
>module.exports = exports : typeof import("tests/cases/conformance/salsa/b")
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/conformance/salsa/b")
+>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
+>exports : typeof import("tests/cases/conformance/salsa/b")
>exports : typeof import("tests/cases/conformance/salsa/b")
multipleDeclarationAlias2.func6 = function () { };
@@ -191,26 +191,26 @@ multipleDeclarationAlias3.func7 = function () { };
>function () { } : () => void
var multipleDeclarationAlias4 = someOtherVariable = module.exports;
->multipleDeclarationAlias4 : any
->someOtherVariable = module.exports : any
+>multipleDeclarationAlias4 : typeof import("tests/cases/conformance/salsa/b")
+>someOtherVariable = module.exports : typeof import("tests/cases/conformance/salsa/b")
>someOtherVariable : any
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/conformance/salsa/b")
+>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
+>exports : typeof import("tests/cases/conformance/salsa/b")
multipleDeclarationAlias4.func8 = function () { };
>multipleDeclarationAlias4.func8 = function () { } : () => void
->multipleDeclarationAlias4.func8 : any
->multipleDeclarationAlias4 : any
->func8 : any
+>multipleDeclarationAlias4.func8 : () => void
+>multipleDeclarationAlias4 : typeof import("tests/cases/conformance/salsa/b")
+>func8 : () => void
>function () { } : () => void
var multipleDeclarationAlias5 = module.exports = exports = {};
>multipleDeclarationAlias5 : {}
>module.exports = exports = {} : {}
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/conformance/salsa/b")
+>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
+>exports : typeof import("tests/cases/conformance/salsa/b")
>exports = {} : {}
>exports : typeof import("tests/cases/conformance/salsa/b")
>{} : {}
@@ -227,9 +227,9 @@ var multipleDeclarationAlias6 = exports = module.exports = {};
>exports = module.exports = {} : {}
>exports : typeof import("tests/cases/conformance/salsa/b")
>module.exports = {} : {}
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/conformance/salsa/b")
+>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
+>exports : typeof import("tests/cases/conformance/salsa/b")
>{} : {}
multipleDeclarationAlias6.func10 = function () { };
@@ -243,9 +243,9 @@ exports = module.exports = someOtherVariable = {};
>exports = module.exports = someOtherVariable = {} : {}
>exports : typeof import("tests/cases/conformance/salsa/b")
>module.exports = someOtherVariable = {} : {}
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/conformance/salsa/b")
+>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
+>exports : typeof import("tests/cases/conformance/salsa/b")
>someOtherVariable = {} : {}
>someOtherVariable : any
>{} : {}
@@ -259,20 +259,20 @@ exports.func11 = function () { };
module.exports.func12 = function () { };
>module.exports.func12 = function () { } : () => void
->module.exports.func12 : any
->module.exports : any
->module : any
->exports : any
->func12 : any
+>module.exports.func12 : () => void
+>module.exports : typeof import("tests/cases/conformance/salsa/b")
+>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
+>exports : typeof import("tests/cases/conformance/salsa/b")
+>func12 : () => void
>function () { } : () => void
exports = module.exports = someOtherVariable = {};
>exports = module.exports = someOtherVariable = {} : {}
>exports : typeof import("tests/cases/conformance/salsa/b")
>module.exports = someOtherVariable = {} : {}
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/conformance/salsa/b")
+>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
+>exports : typeof import("tests/cases/conformance/salsa/b")
>someOtherVariable = {} : {}
>someOtherVariable : any
>{} : {}
@@ -286,20 +286,20 @@ exports.func11 = function () { };
module.exports.func12 = function () { };
>module.exports.func12 = function () { } : () => void
->module.exports.func12 : any
->module.exports : any
->module : any
->exports : any
->func12 : any
+>module.exports.func12 : () => void
+>module.exports : typeof import("tests/cases/conformance/salsa/b")
+>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
+>exports : typeof import("tests/cases/conformance/salsa/b")
+>func12 : () => void
>function () { } : () => void
exports = module.exports = {};
>exports = module.exports = {} : {}
>exports : typeof import("tests/cases/conformance/salsa/b")
>module.exports = {} : {}
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/conformance/salsa/b")
+>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
+>exports : typeof import("tests/cases/conformance/salsa/b")
>{} : {}
exports.func13 = function () { };
@@ -311,20 +311,20 @@ exports.func13 = function () { };
module.exports.func14 = function () { };
>module.exports.func14 = function () { } : () => void
->module.exports.func14 : any
->module.exports : any
->module : any
->exports : any
->func14 : any
+>module.exports.func14 : () => void
+>module.exports : typeof import("tests/cases/conformance/salsa/b")
+>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
+>exports : typeof import("tests/cases/conformance/salsa/b")
+>func14 : () => void
>function () { } : () => void
exports = module.exports = {};
>exports = module.exports = {} : {}
>exports : typeof import("tests/cases/conformance/salsa/b")
>module.exports = {} : {}
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/conformance/salsa/b")
+>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
+>exports : typeof import("tests/cases/conformance/salsa/b")
>{} : {}
exports.func15 = function () { };
@@ -336,18 +336,18 @@ exports.func15 = function () { };
module.exports.func16 = function () { };
>module.exports.func16 = function () { } : () => void
->module.exports.func16 : any
->module.exports : any
->module : any
->exports : any
->func16 : any
+>module.exports.func16 : () => void
+>module.exports : typeof import("tests/cases/conformance/salsa/b")
+>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
+>exports : typeof import("tests/cases/conformance/salsa/b")
+>func16 : () => void
>function () { } : () => void
module.exports = exports = {};
>module.exports = exports = {} : {}
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/conformance/salsa/b")
+>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
+>exports : typeof import("tests/cases/conformance/salsa/b")
>exports = {} : {}
>exports : typeof import("tests/cases/conformance/salsa/b")
>{} : {}
@@ -361,18 +361,18 @@ exports.func17 = function () { };
module.exports.func18 = function () { };
>module.exports.func18 = function () { } : () => void
->module.exports.func18 : any
->module.exports : any
->module : any
->exports : any
->func18 : any
+>module.exports.func18 : () => void
+>module.exports : typeof import("tests/cases/conformance/salsa/b")
+>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
+>exports : typeof import("tests/cases/conformance/salsa/b")
+>func18 : () => void
>function () { } : () => void
module.exports = {};
>module.exports = {} : {}
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/conformance/salsa/b")
+>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
+>exports : typeof import("tests/cases/conformance/salsa/b")
>{} : {}
exports.func19 = function () { };
@@ -384,11 +384,11 @@ exports.func19 = function () { };
module.exports.func20 = function () { };
>module.exports.func20 = function () { } : () => void
->module.exports.func20 : any
->module.exports : any
->module : any
->exports : any
->func20 : any
+>module.exports.func20 : () => void
+>module.exports : typeof import("tests/cases/conformance/salsa/b")
+>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
+>exports : typeof import("tests/cases/conformance/salsa/b")
+>func20 : () => void
>function () { } : () => void
diff --git a/tests/baselines/reference/moduleExportAlias3.symbols b/tests/baselines/reference/moduleExportAlias3.symbols
index 740c3004d105a..5b68b27e606c1 100644
--- a/tests/baselines/reference/moduleExportAlias3.symbols
+++ b/tests/baselines/reference/moduleExportAlias3.symbols
@@ -4,6 +4,7 @@ class C {
>C : Symbol(C, Decl(bug24062.js, 0, 0))
}
module.exports = {
+>module.exports : Symbol("tests/cases/conformance/salsa/bug24062", Decl(bug24062.js, 0, 0))
>module : Symbol(export=, Decl(bug24062.js, 2, 1))
>exports : Symbol(export=, Decl(bug24062.js, 2, 1))
diff --git a/tests/baselines/reference/moduleExportAlias3.types b/tests/baselines/reference/moduleExportAlias3.types
index 872eb3ef76efd..afab885d667e1 100644
--- a/tests/baselines/reference/moduleExportAlias3.types
+++ b/tests/baselines/reference/moduleExportAlias3.types
@@ -5,9 +5,9 @@ class C {
}
module.exports = {
>module.exports = { C} : { [x: string]: any; C: typeof C; }
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/conformance/salsa/bug24062")
+>module : { "tests/cases/conformance/salsa/bug24062": typeof import("tests/cases/conformance/salsa/bug24062"); }
+>exports : typeof import("tests/cases/conformance/salsa/bug24062")
>{ C} : { [x: string]: any; C: typeof C; }
C
diff --git a/tests/baselines/reference/moduleExportAlias4.symbols b/tests/baselines/reference/moduleExportAlias4.symbols
index 859d3eeb0edfd..c13cdd67992f4 100644
--- a/tests/baselines/reference/moduleExportAlias4.symbols
+++ b/tests/baselines/reference/moduleExportAlias4.symbols
@@ -6,13 +6,16 @@ var wat = require('./bug24024')
>'./bug24024' : Symbol("tests/cases/conformance/salsa/bug24024", Decl(bug24024.js, 0, 0))
module.exports = class C {}
+>module.exports : Symbol("tests/cases/conformance/salsa/bug24024", Decl(bug24024.js, 0, 0))
>module : Symbol(export=, Decl(bug24024.js, 1, 31))
>exports : Symbol(export=, Decl(bug24024.js, 1, 31))
>C : Symbol(C, Decl(bug24024.js, 2, 16))
module.exports.D = class D { }
+>module.exports.D : Symbol(D, Decl(bug24024.js, 2, 27))
>module.exports : Symbol(D, Decl(bug24024.js, 2, 27))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/bug24024", Decl(bug24024.js, 0, 0))
>D : Symbol(D, Decl(bug24024.js, 2, 27))
>D : Symbol(D, Decl(bug24024.js, 3, 18))
diff --git a/tests/baselines/reference/moduleExportAlias4.types b/tests/baselines/reference/moduleExportAlias4.types
index 33a7aac2cb468..988604be28e3d 100644
--- a/tests/baselines/reference/moduleExportAlias4.types
+++ b/tests/baselines/reference/moduleExportAlias4.types
@@ -8,19 +8,19 @@ var wat = require('./bug24024')
module.exports = class C {}
>module.exports = class C {} : typeof C
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/conformance/salsa/bug24024")
+>module : { "tests/cases/conformance/salsa/bug24024": typeof import("tests/cases/conformance/salsa/bug24024"); }
+>exports : typeof import("tests/cases/conformance/salsa/bug24024")
>class C {} : typeof C
>C : typeof C
module.exports.D = class D { }
>module.exports.D = class D { } : typeof D
->module.exports.D : any
->module.exports : any
->module : any
->exports : any
->D : any
+>module.exports.D : typeof D
+>module.exports : typeof import("tests/cases/conformance/salsa/bug24024")
+>module : { "tests/cases/conformance/salsa/bug24024": typeof import("tests/cases/conformance/salsa/bug24024"); }
+>exports : typeof import("tests/cases/conformance/salsa/bug24024")
+>D : typeof D
>class D { } : typeof D
>D : typeof D
diff --git a/tests/baselines/reference/moduleExportNestedNamespaces.symbols b/tests/baselines/reference/moduleExportNestedNamespaces.symbols
index 566221b3a5629..233bda7be2fb8 100644
--- a/tests/baselines/reference/moduleExportNestedNamespaces.symbols
+++ b/tests/baselines/reference/moduleExportNestedNamespaces.symbols
@@ -1,21 +1,30 @@
=== tests/cases/conformance/salsa/mod.js ===
module.exports.n = {};
+>module.exports.n : Symbol(n, Decl(mod.js, 0, 0), Decl(mod.js, 1, 15))
>module.exports : Symbol(n, Decl(mod.js, 0, 0), Decl(mod.js, 1, 15))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/mod", Decl(mod.js, 0, 0))
>n : Symbol(n, Decl(mod.js, 0, 0), Decl(mod.js, 1, 15))
module.exports.n.K = function C() {
+>module.exports.n.K : Symbol(n.K, Decl(mod.js, 0, 22))
>module.exports.n : Symbol(n.K, Decl(mod.js, 0, 22))
+>module.exports : Symbol("tests/cases/conformance/salsa/mod", Decl(mod.js, 0, 0))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/mod", Decl(mod.js, 0, 0))
+>n : Symbol(n, Decl(mod.js, 0, 0), Decl(mod.js, 1, 15))
>K : Symbol(n.K, Decl(mod.js, 0, 22))
>C : Symbol(C, Decl(mod.js, 1, 20))
this.x = 10;
+>this : Symbol(n, Decl(mod.js, 0, 0), Decl(mod.js, 1, 15))
>x : Symbol(C.x, Decl(mod.js, 1, 35))
}
module.exports.Classic = class {
+>module.exports.Classic : Symbol(Classic, Decl(mod.js, 3, 1))
>module.exports : Symbol(Classic, Decl(mod.js, 3, 1))
>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/mod", Decl(mod.js, 0, 0))
>Classic : Symbol(Classic, Decl(mod.js, 3, 1))
constructor() {
diff --git a/tests/baselines/reference/moduleExportNestedNamespaces.types b/tests/baselines/reference/moduleExportNestedNamespaces.types
index def26bac423c7..0267a4a4f9709 100644
--- a/tests/baselines/reference/moduleExportNestedNamespaces.types
+++ b/tests/baselines/reference/moduleExportNestedNamespaces.types
@@ -1,39 +1,39 @@
=== tests/cases/conformance/salsa/mod.js ===
module.exports.n = {};
->module.exports.n = {} : any
->module.exports.n : any
->module.exports : any
->module : any
->exports : any
->n : any
+>module.exports.n = {} : typeof n
+>module.exports.n : typeof n
+>module.exports : typeof import("tests/cases/conformance/salsa/mod")
+>module : { "tests/cases/conformance/salsa/mod": typeof import("tests/cases/conformance/salsa/mod"); }
+>exports : typeof import("tests/cases/conformance/salsa/mod")
+>n : typeof n
>{} : { [x: string]: any; }
module.exports.n.K = function C() {
>module.exports.n.K = function C() { this.x = 10;} : typeof C
->module.exports.n.K : any
->module.exports.n : any
->module.exports : any
->module : any
->exports : any
->n : any
->K : any
+>module.exports.n.K : typeof C
+>module.exports.n : typeof n
+>module.exports : typeof import("tests/cases/conformance/salsa/mod")
+>module : { "tests/cases/conformance/salsa/mod": typeof import("tests/cases/conformance/salsa/mod"); }
+>exports : typeof import("tests/cases/conformance/salsa/mod")
+>n : typeof n
+>K : typeof C
>function C() { this.x = 10;} : typeof C
>C : typeof C
this.x = 10;
>this.x = 10 : 10
>this.x : any
->this : any
+>this : typeof n
>x : any
>10 : 10
}
module.exports.Classic = class {
>module.exports.Classic = class { constructor() { this.p = 1 }} : typeof Classic
->module.exports.Classic : any
->module.exports : any
->module : any
->exports : any
->Classic : any
+>module.exports.Classic : typeof Classic
+>module.exports : typeof import("tests/cases/conformance/salsa/mod")
+>module : { "tests/cases/conformance/salsa/mod": typeof import("tests/cases/conformance/salsa/mod"); }
+>exports : typeof import("tests/cases/conformance/salsa/mod")
+>Classic : typeof Classic
>class { constructor() { this.p = 1 }} : typeof Classic
constructor() {
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.errors.txt b/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.errors.txt
index 66cb517a25be7..f4c1c7063fb5e 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.errors.txt
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.errors.txt
@@ -1,4 +1,5 @@
tests/cases/conformance/salsa/a.js(4,6): error TS2339: Property 'f' does not exist on type 'number'.
+tests/cases/conformance/salsa/mod1.js(2,1): error TS2322: Type '1' is not assignable to type 'typeof import("tests/cases/conformance/salsa/mod1")'.
==== tests/cases/conformance/salsa/a.js (1 errors) ====
@@ -12,8 +13,10 @@ tests/cases/conformance/salsa/a.js(4,6): error TS2339: Property 'f' does not exi
==== tests/cases/conformance/salsa/requires.d.ts (0 errors) ====
declare var module: { exports: any };
declare function require(name: string): any;
-==== tests/cases/conformance/salsa/mod1.js (0 errors) ====
+==== tests/cases/conformance/salsa/mod1.js (1 errors) ====
///
module.exports = 1
+ ~~~~~~~~~~~~~~
+!!! error TS2322: Type '1' is not assignable to type 'typeof import("tests/cases/conformance/salsa/mod1")'.
module.exports.f = function () { }
\ No newline at end of file
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.symbols b/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.symbols
index 0806042409683..e8bbbd4f8a4fb 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.symbols
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.symbols
@@ -25,13 +25,14 @@ declare function require(name: string): any;
=== tests/cases/conformance/salsa/mod1.js ===
///
module.exports = 1
->module.exports : Symbol(exports, Decl(requires.d.ts, 0, 21))
+>module.exports : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
>module : Symbol(export=, Decl(mod1.js, 0, 0))
>exports : Symbol(export=, Decl(mod1.js, 0, 0))
module.exports.f = function () { }
+>module.exports.f : Symbol(f, Decl(mod1.js, 1, 18))
>module.exports : Symbol(f, Decl(mod1.js, 1, 18))
->module : Symbol(module, Decl(requires.d.ts, 0, 11))
->exports : Symbol(exports, Decl(requires.d.ts, 0, 21))
+>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
>f : Symbol(f, Decl(mod1.js, 1, 18))
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.types b/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.types
index 8af94a05fa5c6..07ffa6c35ce99 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.types
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.types
@@ -32,17 +32,17 @@ declare function require(name: string): any;
///
module.exports = 1
>module.exports = 1 : 1
->module.exports : any
->module : { exports: any; }
->exports : any
+>module.exports : typeof import("tests/cases/conformance/salsa/mod1")
+>module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
+>exports : typeof import("tests/cases/conformance/salsa/mod1")
>1 : 1
module.exports.f = function () { }
>module.exports.f = function () { } : () => void
->module.exports.f : any
->module.exports : any
->module : { exports: any; }
->exports : any
->f : any
+>module.exports.f : () => void
+>module.exports : typeof import("tests/cases/conformance/salsa/mod1")
+>module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
+>exports : typeof import("tests/cases/conformance/salsa/mod1")
+>f : () => void
>function () { } : () => void
diff --git a/tests/baselines/reference/paramTagTypeResolution.symbols b/tests/baselines/reference/paramTagTypeResolution.symbols
index 1584e2fcb95c6..0622abf2c41b9 100644
--- a/tests/baselines/reference/paramTagTypeResolution.symbols
+++ b/tests/baselines/reference/paramTagTypeResolution.symbols
@@ -14,6 +14,7 @@ f(1, n => { })
* @param {(t: T) => void} k
*/
module.exports = function (x, k) { return k(x) }
+>module.exports : Symbol("tests/cases/conformance/jsdoc/first", Decl(first.js, 0, 0))
>module : Symbol(export=, Decl(first.js, 0, 0))
>exports : Symbol(export=, Decl(first.js, 0, 0))
>x : Symbol(x, Decl(first.js, 4, 27))
diff --git a/tests/baselines/reference/paramTagTypeResolution.types b/tests/baselines/reference/paramTagTypeResolution.types
index daf7749c6bb84..ac81a46fd45b8 100644
--- a/tests/baselines/reference/paramTagTypeResolution.types
+++ b/tests/baselines/reference/paramTagTypeResolution.types
@@ -19,9 +19,9 @@ f(1, n => { })
*/
module.exports = function (x, k) { return k(x) }
>module.exports = function (x, k) { return k(x) } : (x: T, k: (t: T) => void) => void
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/conformance/jsdoc/first")
+>module : { "tests/cases/conformance/jsdoc/first": typeof import("tests/cases/conformance/jsdoc/first"); }
+>exports : typeof import("tests/cases/conformance/jsdoc/first")
>function (x, k) { return k(x) } : (x: T, k: (t: T) => void) => void
>x : T
>k : (t: T) => void
diff --git a/tests/baselines/reference/typeFromPropertyAssignment17.symbols b/tests/baselines/reference/typeFromPropertyAssignment17.symbols
index cbb5324cab07f..6708c25796e64 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment17.symbols
+++ b/tests/baselines/reference/typeFromPropertyAssignment17.symbols
@@ -38,6 +38,7 @@ declare var module: any;
=== tests/cases/conformance/salsa/minimatch.js ===
///
module.exports = minimatch
+>module.exports : Symbol("tests/cases/conformance/salsa/minimatch", Decl(minimatch.js, 0, 0))
>module : Symbol(export=, Decl(minimatch.js, 0, 0))
>exports : Symbol(export=, Decl(minimatch.js, 0, 0))
>minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1))
diff --git a/tests/baselines/reference/typeFromPropertyAssignment17.types b/tests/baselines/reference/typeFromPropertyAssignment17.types
index f325d89c494ad..754cd70f21a7f 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment17.types
+++ b/tests/baselines/reference/typeFromPropertyAssignment17.types
@@ -44,9 +44,9 @@ declare var module: any;
///
module.exports = minimatch
>module.exports = minimatch : { (): void; M: typeof M; filter: () => void; }
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/conformance/salsa/minimatch")
+>module : { "tests/cases/conformance/salsa/minimatch": typeof import("tests/cases/conformance/salsa/minimatch"); }
+>exports : typeof import("tests/cases/conformance/salsa/minimatch")
>minimatch : { (): void; M: typeof M; filter: () => void; }
minimatch.M = M
diff --git a/tests/baselines/reference/typeFromPropertyAssignment19.symbols b/tests/baselines/reference/typeFromPropertyAssignment19.symbols
index 4752034a0aa57..39361e90c5f4c 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment19.symbols
+++ b/tests/baselines/reference/typeFromPropertyAssignment19.symbols
@@ -22,6 +22,7 @@ declare var module: any;
///
exports = module.exports = C
>exports : Symbol("tests/cases/conformance/salsa/semver", Decl(semver.js, 0, 0))
+>module.exports : Symbol("tests/cases/conformance/salsa/semver", Decl(semver.js, 0, 0))
>module : Symbol(export=, Decl(semver.js, 1, 9))
>exports : Symbol(export=, Decl(semver.js, 1, 9))
>C : Symbol(C, Decl(semver.js, 2, 16), Decl(semver.js, 1, 28))
diff --git a/tests/baselines/reference/typeFromPropertyAssignment19.types b/tests/baselines/reference/typeFromPropertyAssignment19.types
index b0200fc231109..9ddd0735bce61 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment19.types
+++ b/tests/baselines/reference/typeFromPropertyAssignment19.types
@@ -27,9 +27,9 @@ exports = module.exports = C
>exports = module.exports = C : typeof C
>exports : typeof import("tests/cases/conformance/salsa/semver")
>module.exports = C : typeof C
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/conformance/salsa/semver")
+>module : { "tests/cases/conformance/salsa/semver": typeof import("tests/cases/conformance/salsa/semver"); }
+>exports : typeof import("tests/cases/conformance/salsa/semver")
>C : typeof C
C.f = n => n + 1
diff --git a/tests/baselines/reference/typedefCrossModule.symbols b/tests/baselines/reference/typedefCrossModule.symbols
index 2ba91903ba3ad..6c16284a557fc 100644
--- a/tests/baselines/reference/typedefCrossModule.symbols
+++ b/tests/baselines/reference/typedefCrossModule.symbols
@@ -9,7 +9,7 @@ declare var module: { exports: any};
/** @typedef {{ type: "b", y: 1 }} B */
/** @typedef {A | B} Both */
module.exports = C
->module.exports : Symbol(exports, Decl(commonjs.d.ts, 0, 21))
+>module.exports : Symbol("tests/cases/conformance/jsdoc/mod1", Decl(mod1.js, 0, 0))
>module : Symbol(export=, Decl(mod1.js, 0, 0))
>exports : Symbol(export=, Decl(mod1.js, 0, 0))
>C : Symbol(C, Decl(mod1.js, 4, 18))
diff --git a/tests/baselines/reference/typedefCrossModule.types b/tests/baselines/reference/typedefCrossModule.types
index 665fa4989918b..eb8dcae587742 100644
--- a/tests/baselines/reference/typedefCrossModule.types
+++ b/tests/baselines/reference/typedefCrossModule.types
@@ -10,9 +10,9 @@ declare var module: { exports: any};
/** @typedef {A | B} Both */
module.exports = C
>module.exports = C : typeof C
->module.exports : any
->module : { exports: any; }
->exports : any
+>module.exports : typeof import("tests/cases/conformance/jsdoc/mod1")
+>module : { "tests/cases/conformance/jsdoc/mod1": typeof import("tests/cases/conformance/jsdoc/mod1"); }
+>exports : typeof import("tests/cases/conformance/jsdoc/mod1")
>C : typeof C
function C() {
diff --git a/tests/baselines/reference/typedefCrossModule3.symbols b/tests/baselines/reference/typedefCrossModule3.symbols
index b41b278b0c3b9..829e243dbac98 100644
--- a/tests/baselines/reference/typedefCrossModule3.symbols
+++ b/tests/baselines/reference/typedefCrossModule3.symbols
@@ -9,6 +9,7 @@ ns.Foo = class {}
>Foo : Symbol(ns.Foo, Decl(mod2.js, 1, 14))
module.exports = ns;
+>module.exports : Symbol("tests/cases/conformance/jsdoc/mod2", Decl(mod2.js, 0, 0))
>module : Symbol(export=, Decl(mod2.js, 2, 17))
>exports : Symbol(export=, Decl(mod2.js, 2, 17))
>ns : Symbol(ns, Decl(mod2.js, 1, 5), Decl(mod2.js, 1, 14))
diff --git a/tests/baselines/reference/typedefCrossModule3.types b/tests/baselines/reference/typedefCrossModule3.types
index b9722719895d4..201c692c6c626 100644
--- a/tests/baselines/reference/typedefCrossModule3.types
+++ b/tests/baselines/reference/typedefCrossModule3.types
@@ -13,9 +13,9 @@ ns.Foo = class {}
module.exports = ns;
>module.exports = ns : typeof ns
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/conformance/jsdoc/mod2")
+>module : { "tests/cases/conformance/jsdoc/mod2": typeof import("tests/cases/conformance/jsdoc/mod2"); }
+>exports : typeof import("tests/cases/conformance/jsdoc/mod2")
>ns : typeof ns
diff --git a/tests/baselines/reference/typedefCrossModule4.symbols b/tests/baselines/reference/typedefCrossModule4.symbols
index aa478df301a9c..bc68e509d776a 100644
--- a/tests/baselines/reference/typedefCrossModule4.symbols
+++ b/tests/baselines/reference/typedefCrossModule4.symbols
@@ -4,6 +4,7 @@ class Bar { }
>Bar : Symbol(Bar, Decl(mod3.js, 0, 0))
module.exports = { Foo: Bar };
+>module.exports : Symbol("tests/cases/conformance/jsdoc/mod3", Decl(mod3.js, 0, 0))
>module : Symbol(export=, Decl(mod3.js, 1, 13))
>exports : Symbol(export=, Decl(mod3.js, 1, 13))
>Foo : Symbol(Foo, Decl(mod3.js, 2, 18))
diff --git a/tests/baselines/reference/typedefCrossModule4.types b/tests/baselines/reference/typedefCrossModule4.types
index a0d14942ef3b5..02c7efb70f563 100644
--- a/tests/baselines/reference/typedefCrossModule4.types
+++ b/tests/baselines/reference/typedefCrossModule4.types
@@ -5,9 +5,9 @@ class Bar { }
module.exports = { Foo: Bar };
>module.exports = { Foo: Bar } : { [x: string]: any; Foo: typeof Bar; }
->module.exports : any
->module : any
->exports : any
+>module.exports : typeof import("tests/cases/conformance/jsdoc/mod3")
+>module : { "tests/cases/conformance/jsdoc/mod3": typeof import("tests/cases/conformance/jsdoc/mod3"); }
+>exports : typeof import("tests/cases/conformance/jsdoc/mod3")
>{ Foo: Bar } : { [x: string]: any; Foo: typeof Bar; }
>Foo : typeof Bar
>Bar : typeof Bar
diff --git a/tests/cases/conformance/salsa/contextualTypedSpecialAssignment.ts b/tests/cases/conformance/salsa/contextualTypedSpecialAssignment.ts
index e4a2b56970c1b..a64f34f35fc96 100644
--- a/tests/cases/conformance/salsa/contextualTypedSpecialAssignment.ts
+++ b/tests/cases/conformance/salsa/contextualTypedSpecialAssignment.ts
@@ -50,8 +50,7 @@ exports.x = {
}
exports.x
-/** @type {DoneStatus} contextual typing is allowed, but module.exports.y: any.
-Guess it doesn't check the type tag? */
+/** @type {DoneStatus} */
module.exports.y = {
status: "done",
m(n) { }
From cf373ee8fcc13e48cfe69d5170abfe29c97d6ed0 Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Tue, 17 Jul 2018 09:00:10 -0700
Subject: [PATCH 05/16] module.exports= always uses lhs type
Conflicts between exports property assignments and exports assignments
should get a union type instead of an error.
---
src/compiler/checker.ts | 3 +-
.../reference/callbackCrossModule.types | 2 +-
.../checkJsTypeDefNoUnusedLocalMarked.types | 2 +-
.../conflictingCommonJSES2015Exports.types | 2 +-
.../reference/constructorFunctions2.types | 2 +-
.../contextualTypedSpecialAssignment.types | 2 +-
.../reference/javascriptCommonjsModule.types | 2 +-
...PropertyInitalizationInObjectLiteral.types | 2 +-
.../baselines/reference/jsdocImportType.types | 2 +-
.../reference/jsdocImportType2.types | 2 +-
.../reference/moduleExportAlias.symbols | 4 ++
.../reference/moduleExportAlias.types | 42 +++++++++----------
.../reference/moduleExportAlias2.symbols | 2 +-
.../reference/moduleExportAlias2.types | 10 ++---
.../reference/moduleExportAlias3.types | 2 +-
.../reference/moduleExportAlias4.types | 2 +-
.../reference/moduleExportAlias5.symbols | 1 +
.../reference/moduleExportAlias5.types | 10 ++---
...ExportWithExportPropertyAssignment.symbols | 7 ++--
...leExportWithExportPropertyAssignment.types | 18 ++++----
...rtWithExportPropertyAssignment2.errors.txt | 5 +--
...eExportWithExportPropertyAssignment2.types | 2 +-
...xportWithExportPropertyAssignment3.symbols | 17 ++++----
...eExportWithExportPropertyAssignment3.types | 38 ++++++++---------
...xportWithExportPropertyAssignment4.symbols | 17 ++++----
...eExportWithExportPropertyAssignment4.types | 38 ++++++++---------
.../reference/paramTagTypeResolution.types | 2 +-
.../typeFromPropertyAssignment17.types | 2 +-
.../typeFromPropertyAssignment19.types | 4 +-
.../reference/typedefCrossModule.types | 2 +-
.../reference/typedefCrossModule2.symbols | 2 +
.../reference/typedefCrossModule2.types | 16 +++----
.../reference/typedefCrossModule3.types | 2 +-
.../reference/typedefCrossModule4.types | 2 +-
34 files changed, 140 insertions(+), 128 deletions(-)
diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts
index b798d97af0301..ca1dcc4c74ae2 100644
--- a/src/compiler/checker.ts
+++ b/src/compiler/checker.ts
@@ -21332,8 +21332,9 @@ namespace ts {
function isJSSpecialPropertyAssignment(special: SpecialPropertyAssignmentKind) {
switch (special) {
- case SpecialPropertyAssignmentKind.ExportsProperty:
case SpecialPropertyAssignmentKind.ModuleExports:
+ return true;
+ case SpecialPropertyAssignmentKind.ExportsProperty:
case SpecialPropertyAssignmentKind.Property:
case SpecialPropertyAssignmentKind.Prototype:
case SpecialPropertyAssignmentKind.PrototypeProperty:
diff --git a/tests/baselines/reference/callbackCrossModule.types b/tests/baselines/reference/callbackCrossModule.types
index fe3f0ad5b1513..efa2fd7159851 100644
--- a/tests/baselines/reference/callbackCrossModule.types
+++ b/tests/baselines/reference/callbackCrossModule.types
@@ -4,7 +4,7 @@
* @return {any} I don't even know what this should return
*/
module.exports = C
->module.exports = C : typeof C
+>module.exports = C : typeof import("tests/cases/conformance/jsdoc/mod1")
>module.exports : typeof import("tests/cases/conformance/jsdoc/mod1")
>module : { "tests/cases/conformance/jsdoc/mod1": typeof import("tests/cases/conformance/jsdoc/mod1"); }
>exports : typeof import("tests/cases/conformance/jsdoc/mod1")
diff --git a/tests/baselines/reference/checkJsTypeDefNoUnusedLocalMarked.types b/tests/baselines/reference/checkJsTypeDefNoUnusedLocalMarked.types
index aac3c50f46241..258a673d6ff6d 100644
--- a/tests/baselines/reference/checkJsTypeDefNoUnusedLocalMarked.types
+++ b/tests/baselines/reference/checkJsTypeDefNoUnusedLocalMarked.types
@@ -22,7 +22,7 @@ export = Foo;
/** @typedef {(foo: Foo) => string} FooFun */
module.exports = /** @type {FooFun} */(void 0);
->module.exports = /** @type {FooFun} */(void 0) : (foo: typeof Foo) => string
+>module.exports = /** @type {FooFun} */(void 0) : typeof import("tests/cases/compiler/something")
>module.exports : typeof import("tests/cases/compiler/something")
>module : { "tests/cases/compiler/something": typeof import("tests/cases/compiler/something"); }
>exports : typeof import("tests/cases/compiler/something")
diff --git a/tests/baselines/reference/conflictingCommonJSES2015Exports.types b/tests/baselines/reference/conflictingCommonJSES2015Exports.types
index ec8ee74123bf8..2d49406a96438 100644
--- a/tests/baselines/reference/conflictingCommonJSES2015Exports.types
+++ b/tests/baselines/reference/conflictingCommonJSES2015Exports.types
@@ -7,7 +7,7 @@ export function abc(a, b, c) { return 5; }
>5 : 5
module.exports = { abc };
->module.exports = { abc } : { abc: (a: any, b: any, c: any) => number; }
+>module.exports = { abc } : typeof import("tests/cases/conformance/salsa/bug24934")
>module.exports : typeof import("tests/cases/conformance/salsa/bug24934")
>module : { "tests/cases/conformance/salsa/bug24934": typeof import("tests/cases/conformance/salsa/bug24934"); }
>exports : typeof import("tests/cases/conformance/salsa/bug24934")
diff --git a/tests/baselines/reference/constructorFunctions2.types b/tests/baselines/reference/constructorFunctions2.types
index ca54eb838ddee..09fd9607aaad7 100644
--- a/tests/baselines/reference/constructorFunctions2.types
+++ b/tests/baselines/reference/constructorFunctions2.types
@@ -69,7 +69,7 @@ function A() { this.id = 1; }
>1 : 1
module.exports = A;
->module.exports = A : typeof A
+>module.exports = A : typeof import("tests/cases/conformance/salsa/other")
>module.exports : typeof import("tests/cases/conformance/salsa/other")
>module : { "tests/cases/conformance/salsa/other": typeof import("tests/cases/conformance/salsa/other"); }
>exports : typeof import("tests/cases/conformance/salsa/other")
diff --git a/tests/baselines/reference/contextualTypedSpecialAssignment.types b/tests/baselines/reference/contextualTypedSpecialAssignment.types
index 5864f262c7e4e..144a6d8864062 100644
--- a/tests/baselines/reference/contextualTypedSpecialAssignment.types
+++ b/tests/baselines/reference/contextualTypedSpecialAssignment.types
@@ -190,7 +190,7 @@ F.prototype = {
// module.exports assignment
/** @type {{ status: 'done', m(n: number): void }} */
module.exports = {
->module.exports = { status: "done", m(n) { }} : { status: string; m(n: any): void; }
+>module.exports = { status: "done", m(n) { }} : typeof import("tests/cases/conformance/salsa/mod")
>module.exports : typeof import("tests/cases/conformance/salsa/mod")
>module : { "tests/cases/conformance/salsa/mod": typeof import("tests/cases/conformance/salsa/mod"); }
>exports : typeof import("tests/cases/conformance/salsa/mod")
diff --git a/tests/baselines/reference/javascriptCommonjsModule.types b/tests/baselines/reference/javascriptCommonjsModule.types
index c71fbdd12a254..29927cb0a199f 100644
--- a/tests/baselines/reference/javascriptCommonjsModule.types
+++ b/tests/baselines/reference/javascriptCommonjsModule.types
@@ -7,7 +7,7 @@ class Bar extends Foo {}
>Foo : Foo
module.exports = Bar;
->module.exports = Bar : typeof Bar
+>module.exports = Bar : typeof import("tests/cases/compiler/index")
>module.exports : typeof import("tests/cases/compiler/index")
>module : { "tests/cases/compiler/index": typeof import("tests/cases/compiler/index"); }
>exports : typeof import("tests/cases/compiler/index")
diff --git a/tests/baselines/reference/jsFileClassPropertyInitalizationInObjectLiteral.types b/tests/baselines/reference/jsFileClassPropertyInitalizationInObjectLiteral.types
index b2fae64521151..7d178c6e60476 100644
--- a/tests/baselines/reference/jsFileClassPropertyInitalizationInObjectLiteral.types
+++ b/tests/baselines/reference/jsFileClassPropertyInitalizationInObjectLiteral.types
@@ -1,6 +1,6 @@
=== tests/cases/compiler/foo.js ===
module.exports = function () {
->module.exports = function () { class A { } return { c: A.b = 1, }} : () => { [x: string]: any; c: number; }
+>module.exports = function () { class A { } return { c: A.b = 1, }} : typeof import("tests/cases/compiler/foo")
>module.exports : typeof import("tests/cases/compiler/foo")
>module : { "tests/cases/compiler/foo": typeof import("tests/cases/compiler/foo"); }
>exports : typeof import("tests/cases/compiler/foo")
diff --git a/tests/baselines/reference/jsdocImportType.types b/tests/baselines/reference/jsdocImportType.types
index b332f7c9bcdcb..32e5e91bd9a11 100644
--- a/tests/baselines/reference/jsdocImportType.types
+++ b/tests/baselines/reference/jsdocImportType.types
@@ -52,7 +52,7 @@ class Chunk {
}
}
module.exports = Chunk;
->module.exports = Chunk : typeof Chunk
+>module.exports = Chunk : typeof import("tests/cases/conformance/jsdoc/mod1")
>module.exports : typeof import("tests/cases/conformance/jsdoc/mod1")
>module : { "tests/cases/conformance/jsdoc/mod1": typeof import("tests/cases/conformance/jsdoc/mod1"); }
>exports : typeof import("tests/cases/conformance/jsdoc/mod1")
diff --git a/tests/baselines/reference/jsdocImportType2.types b/tests/baselines/reference/jsdocImportType2.types
index a5b22208a77dc..5efa7faf1f4b5 100644
--- a/tests/baselines/reference/jsdocImportType2.types
+++ b/tests/baselines/reference/jsdocImportType2.types
@@ -40,7 +40,7 @@ declare var module: { exports: any };
=== tests/cases/conformance/jsdoc/mod1.js ===
///
module.exports = class Chunk {
->module.exports = class Chunk { constructor() { this.chunk = 1; }} : typeof Chunk
+>module.exports = class Chunk { constructor() { this.chunk = 1; }} : typeof import("tests/cases/conformance/jsdoc/mod1")
>module.exports : typeof import("tests/cases/conformance/jsdoc/mod1")
>module : { "tests/cases/conformance/jsdoc/mod1": typeof import("tests/cases/conformance/jsdoc/mod1"); }
>exports : typeof import("tests/cases/conformance/jsdoc/mod1")
diff --git a/tests/baselines/reference/moduleExportAlias.symbols b/tests/baselines/reference/moduleExportAlias.symbols
index 268bd484ca07b..0761939ad7848 100644
--- a/tests/baselines/reference/moduleExportAlias.symbols
+++ b/tests/baselines/reference/moduleExportAlias.symbols
@@ -193,7 +193,9 @@ var multipleDeclarationAlias5 = module.exports = exports = {};
>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
multipleDeclarationAlias5.func9 = function () { };
+>multipleDeclarationAlias5.func9 : Symbol(func9, Decl(b.js, 21, 62))
>multipleDeclarationAlias5 : Symbol(multipleDeclarationAlias5, Decl(b.js, 21, 3))
+>func9 : Symbol(func9, Decl(b.js, 21, 62))
var multipleDeclarationAlias6 = exports = module.exports = {};
>multipleDeclarationAlias6 : Symbol(multipleDeclarationAlias6, Decl(b.js, 24, 3))
@@ -203,7 +205,9 @@ var multipleDeclarationAlias6 = exports = module.exports = {};
>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
multipleDeclarationAlias6.func10 = function () { };
+>multipleDeclarationAlias6.func10 : Symbol(func10, Decl(b.js, 24, 62))
>multipleDeclarationAlias6 : Symbol(multipleDeclarationAlias6, Decl(b.js, 24, 3))
+>func10 : Symbol(func10, Decl(b.js, 24, 62))
exports = module.exports = someOtherVariable = {};
>exports : Symbol("tests/cases/conformance/salsa/b", Decl(b.js, 0, 0))
diff --git a/tests/baselines/reference/moduleExportAlias.types b/tests/baselines/reference/moduleExportAlias.types
index 39eb75f912aa5..4e52412620218 100644
--- a/tests/baselines/reference/moduleExportAlias.types
+++ b/tests/baselines/reference/moduleExportAlias.types
@@ -206,8 +206,8 @@ multipleDeclarationAlias4.func8 = function () { };
>function () { } : () => void
var multipleDeclarationAlias5 = module.exports = exports = {};
->multipleDeclarationAlias5 : {}
->module.exports = exports = {} : {}
+>multipleDeclarationAlias5 : typeof import("tests/cases/conformance/salsa/b")
+>module.exports = exports = {} : typeof import("tests/cases/conformance/salsa/b")
>module.exports : typeof import("tests/cases/conformance/salsa/b")
>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
>exports : typeof import("tests/cases/conformance/salsa/b")
@@ -217,16 +217,16 @@ var multipleDeclarationAlias5 = module.exports = exports = {};
multipleDeclarationAlias5.func9 = function () { };
>multipleDeclarationAlias5.func9 = function () { } : () => void
->multipleDeclarationAlias5.func9 : any
->multipleDeclarationAlias5 : {}
->func9 : any
+>multipleDeclarationAlias5.func9 : () => void
+>multipleDeclarationAlias5 : typeof import("tests/cases/conformance/salsa/b")
+>func9 : () => void
>function () { } : () => void
var multipleDeclarationAlias6 = exports = module.exports = {};
->multipleDeclarationAlias6 : {}
->exports = module.exports = {} : {}
+>multipleDeclarationAlias6 : typeof import("tests/cases/conformance/salsa/b")
+>exports = module.exports = {} : typeof import("tests/cases/conformance/salsa/b")
>exports : typeof import("tests/cases/conformance/salsa/b")
->module.exports = {} : {}
+>module.exports = {} : typeof import("tests/cases/conformance/salsa/b")
>module.exports : typeof import("tests/cases/conformance/salsa/b")
>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
>exports : typeof import("tests/cases/conformance/salsa/b")
@@ -234,15 +234,15 @@ var multipleDeclarationAlias6 = exports = module.exports = {};
multipleDeclarationAlias6.func10 = function () { };
>multipleDeclarationAlias6.func10 = function () { } : () => void
->multipleDeclarationAlias6.func10 : any
->multipleDeclarationAlias6 : {}
->func10 : any
+>multipleDeclarationAlias6.func10 : () => void
+>multipleDeclarationAlias6 : typeof import("tests/cases/conformance/salsa/b")
+>func10 : () => void
>function () { } : () => void
exports = module.exports = someOtherVariable = {};
->exports = module.exports = someOtherVariable = {} : {}
+>exports = module.exports = someOtherVariable = {} : typeof import("tests/cases/conformance/salsa/b")
>exports : typeof import("tests/cases/conformance/salsa/b")
->module.exports = someOtherVariable = {} : {}
+>module.exports = someOtherVariable = {} : typeof import("tests/cases/conformance/salsa/b")
>module.exports : typeof import("tests/cases/conformance/salsa/b")
>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
>exports : typeof import("tests/cases/conformance/salsa/b")
@@ -267,9 +267,9 @@ module.exports.func12 = function () { };
>function () { } : () => void
exports = module.exports = someOtherVariable = {};
->exports = module.exports = someOtherVariable = {} : {}
+>exports = module.exports = someOtherVariable = {} : typeof import("tests/cases/conformance/salsa/b")
>exports : typeof import("tests/cases/conformance/salsa/b")
->module.exports = someOtherVariable = {} : {}
+>module.exports = someOtherVariable = {} : typeof import("tests/cases/conformance/salsa/b")
>module.exports : typeof import("tests/cases/conformance/salsa/b")
>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
>exports : typeof import("tests/cases/conformance/salsa/b")
@@ -294,9 +294,9 @@ module.exports.func12 = function () { };
>function () { } : () => void
exports = module.exports = {};
->exports = module.exports = {} : {}
+>exports = module.exports = {} : typeof import("tests/cases/conformance/salsa/b")
>exports : typeof import("tests/cases/conformance/salsa/b")
->module.exports = {} : {}
+>module.exports = {} : typeof import("tests/cases/conformance/salsa/b")
>module.exports : typeof import("tests/cases/conformance/salsa/b")
>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
>exports : typeof import("tests/cases/conformance/salsa/b")
@@ -319,9 +319,9 @@ module.exports.func14 = function () { };
>function () { } : () => void
exports = module.exports = {};
->exports = module.exports = {} : {}
+>exports = module.exports = {} : typeof import("tests/cases/conformance/salsa/b")
>exports : typeof import("tests/cases/conformance/salsa/b")
->module.exports = {} : {}
+>module.exports = {} : typeof import("tests/cases/conformance/salsa/b")
>module.exports : typeof import("tests/cases/conformance/salsa/b")
>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
>exports : typeof import("tests/cases/conformance/salsa/b")
@@ -344,7 +344,7 @@ module.exports.func16 = function () { };
>function () { } : () => void
module.exports = exports = {};
->module.exports = exports = {} : {}
+>module.exports = exports = {} : typeof import("tests/cases/conformance/salsa/b")
>module.exports : typeof import("tests/cases/conformance/salsa/b")
>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
>exports : typeof import("tests/cases/conformance/salsa/b")
@@ -369,7 +369,7 @@ module.exports.func18 = function () { };
>function () { } : () => void
module.exports = {};
->module.exports = {} : {}
+>module.exports = {} : typeof import("tests/cases/conformance/salsa/b")
>module.exports : typeof import("tests/cases/conformance/salsa/b")
>module : { "tests/cases/conformance/salsa/b": typeof import("tests/cases/conformance/salsa/b"); }
>exports : typeof import("tests/cases/conformance/salsa/b")
diff --git a/tests/baselines/reference/moduleExportAlias2.symbols b/tests/baselines/reference/moduleExportAlias2.symbols
index 52e089050b171..6dc88d4d8c992 100644
--- a/tests/baselines/reference/moduleExportAlias2.symbols
+++ b/tests/baselines/reference/moduleExportAlias2.symbols
@@ -31,7 +31,7 @@ declare var module: { exports: any };
///
exports = module.exports = C
>exports : Symbol("tests/cases/conformance/salsa/semver", Decl(semver.js, 0, 0))
->module.exports : Symbol(exports, Decl(node.d.ts, 2, 21))
+>module.exports : Symbol("tests/cases/conformance/salsa/semver", Decl(semver.js, 0, 0))
>module : Symbol(export=, Decl(semver.js, 1, 9))
>exports : Symbol(export=, Decl(semver.js, 1, 9))
>C : Symbol(C, Decl(semver.js, 2, 22))
diff --git a/tests/baselines/reference/moduleExportAlias2.types b/tests/baselines/reference/moduleExportAlias2.types
index c76c2c33c4553..2d2957c5db4b9 100644
--- a/tests/baselines/reference/moduleExportAlias2.types
+++ b/tests/baselines/reference/moduleExportAlias2.types
@@ -34,12 +34,12 @@ declare var module: { exports: any };
=== tests/cases/conformance/salsa/semver.js ===
///
exports = module.exports = C
->exports = module.exports = C : typeof C
+>exports = module.exports = C : typeof import("tests/cases/conformance/salsa/semver")
+>exports : typeof import("tests/cases/conformance/salsa/semver")
+>module.exports = C : typeof import("tests/cases/conformance/salsa/semver")
+>module.exports : typeof import("tests/cases/conformance/salsa/semver")
+>module : { "tests/cases/conformance/salsa/semver": typeof import("tests/cases/conformance/salsa/semver"); }
>exports : typeof import("tests/cases/conformance/salsa/semver")
->module.exports = C : typeof C
->module.exports : any
->module : { exports: any; }
->exports : any
>C : typeof C
exports.f = n => n + 1
diff --git a/tests/baselines/reference/moduleExportAlias3.types b/tests/baselines/reference/moduleExportAlias3.types
index afab885d667e1..88c076d850531 100644
--- a/tests/baselines/reference/moduleExportAlias3.types
+++ b/tests/baselines/reference/moduleExportAlias3.types
@@ -4,7 +4,7 @@ class C {
>C : C
}
module.exports = {
->module.exports = { C} : { [x: string]: any; C: typeof C; }
+>module.exports = { C} : typeof import("tests/cases/conformance/salsa/bug24062")
>module.exports : typeof import("tests/cases/conformance/salsa/bug24062")
>module : { "tests/cases/conformance/salsa/bug24062": typeof import("tests/cases/conformance/salsa/bug24062"); }
>exports : typeof import("tests/cases/conformance/salsa/bug24062")
diff --git a/tests/baselines/reference/moduleExportAlias4.types b/tests/baselines/reference/moduleExportAlias4.types
index 988604be28e3d..2bd5bb93ac269 100644
--- a/tests/baselines/reference/moduleExportAlias4.types
+++ b/tests/baselines/reference/moduleExportAlias4.types
@@ -7,7 +7,7 @@ var wat = require('./bug24024')
>'./bug24024' : "./bug24024"
module.exports = class C {}
->module.exports = class C {} : typeof C
+>module.exports = class C {} : typeof import("tests/cases/conformance/salsa/bug24024")
>module.exports : typeof import("tests/cases/conformance/salsa/bug24024")
>module : { "tests/cases/conformance/salsa/bug24024": typeof import("tests/cases/conformance/salsa/bug24024"); }
>exports : typeof import("tests/cases/conformance/salsa/bug24024")
diff --git a/tests/baselines/reference/moduleExportAlias5.symbols b/tests/baselines/reference/moduleExportAlias5.symbols
index f856e9ae32ce8..cc9cd7212f471 100644
--- a/tests/baselines/reference/moduleExportAlias5.symbols
+++ b/tests/baselines/reference/moduleExportAlias5.symbols
@@ -5,6 +5,7 @@ const webpack = function (){
}
exports = module.exports = webpack;
>exports : Symbol("tests/cases/conformance/salsa/bug24754", Decl(bug24754.js, 0, 0))
+>module.exports : Symbol("tests/cases/conformance/salsa/bug24754", Decl(bug24754.js, 0, 0))
>module : Symbol(export=, Decl(bug24754.js, 3, 9))
>exports : Symbol(export=, Decl(bug24754.js, 3, 9))
>webpack : Symbol(webpack, Decl(bug24754.js, 1, 5))
diff --git a/tests/baselines/reference/moduleExportAlias5.types b/tests/baselines/reference/moduleExportAlias5.types
index 47a5cb3ddfaad..41b0f013e38dc 100644
--- a/tests/baselines/reference/moduleExportAlias5.types
+++ b/tests/baselines/reference/moduleExportAlias5.types
@@ -5,12 +5,12 @@ const webpack = function (){
>function (){} : { (): void; WebpackOptionsDefaulter: number; }
}
exports = module.exports = webpack;
->exports = module.exports = webpack : { (): void; WebpackOptionsDefaulter: number; }
+>exports = module.exports = webpack : typeof import("tests/cases/conformance/salsa/bug24754")
+>exports : typeof import("tests/cases/conformance/salsa/bug24754")
+>module.exports = webpack : typeof import("tests/cases/conformance/salsa/bug24754")
+>module.exports : typeof import("tests/cases/conformance/salsa/bug24754")
+>module : { "tests/cases/conformance/salsa/bug24754": typeof import("tests/cases/conformance/salsa/bug24754"); }
>exports : typeof import("tests/cases/conformance/salsa/bug24754")
->module.exports = webpack : { (): void; WebpackOptionsDefaulter: number; }
->module.exports : any
->module : any
->exports : any
>webpack : { (): void; WebpackOptionsDefaulter: number; }
exports.version = 1001;
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment.symbols b/tests/baselines/reference/moduleExportWithExportPropertyAssignment.symbols
index c5120a80571e3..4398dffd7d630 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment.symbols
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment.symbols
@@ -25,15 +25,16 @@ declare function require(name: string): any;
=== tests/cases/conformance/salsa/mod1.js ===
///
module.exports = function () { }
->module.exports : Symbol(exports, Decl(requires.d.ts, 0, 21))
+>module.exports : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
>module : Symbol(export=, Decl(mod1.js, 0, 0))
>exports : Symbol(export=, Decl(mod1.js, 0, 0))
/** @param {number} a */
module.exports.f = function (a) { }
+>module.exports.f : Symbol(f, Decl(mod1.js, 1, 32))
>module.exports : Symbol(f, Decl(mod1.js, 1, 32))
->module : Symbol(module, Decl(requires.d.ts, 0, 11))
->exports : Symbol(exports, Decl(requires.d.ts, 0, 21))
+>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
>f : Symbol(f, Decl(mod1.js, 1, 32))
>a : Symbol(a, Decl(mod1.js, 3, 29))
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment.types b/tests/baselines/reference/moduleExportWithExportPropertyAssignment.types
index b7170842c1f39..3ed45fb921fcd 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment.types
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment.types
@@ -28,20 +28,20 @@ declare function require(name: string): any;
=== tests/cases/conformance/salsa/mod1.js ===
///
module.exports = function () { }
->module.exports = function () { } : () => void
->module.exports : any
->module : { exports: any; }
->exports : any
+>module.exports = function () { } : typeof import("tests/cases/conformance/salsa/mod1")
+>module.exports : typeof import("tests/cases/conformance/salsa/mod1")
+>module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
+>exports : typeof import("tests/cases/conformance/salsa/mod1")
>function () { } : () => void
/** @param {number} a */
module.exports.f = function (a) { }
>module.exports.f = function (a) { } : (a: number) => void
->module.exports.f : any
->module.exports : any
->module : { exports: any; }
->exports : any
->f : any
+>module.exports.f : (a: number) => void
+>module.exports : typeof import("tests/cases/conformance/salsa/mod1")
+>module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
+>exports : typeof import("tests/cases/conformance/salsa/mod1")
+>f : (a: number) => void
>function (a) { } : (a: number) => void
>a : number
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.errors.txt b/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.errors.txt
index f4c1c7063fb5e..66cb517a25be7 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.errors.txt
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.errors.txt
@@ -1,5 +1,4 @@
tests/cases/conformance/salsa/a.js(4,6): error TS2339: Property 'f' does not exist on type 'number'.
-tests/cases/conformance/salsa/mod1.js(2,1): error TS2322: Type '1' is not assignable to type 'typeof import("tests/cases/conformance/salsa/mod1")'.
==== tests/cases/conformance/salsa/a.js (1 errors) ====
@@ -13,10 +12,8 @@ tests/cases/conformance/salsa/mod1.js(2,1): error TS2322: Type '1' is not assign
==== tests/cases/conformance/salsa/requires.d.ts (0 errors) ====
declare var module: { exports: any };
declare function require(name: string): any;
-==== tests/cases/conformance/salsa/mod1.js (1 errors) ====
+==== tests/cases/conformance/salsa/mod1.js (0 errors) ====
///
module.exports = 1
- ~~~~~~~~~~~~~~
-!!! error TS2322: Type '1' is not assignable to type 'typeof import("tests/cases/conformance/salsa/mod1")'.
module.exports.f = function () { }
\ No newline at end of file
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.types b/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.types
index 07ffa6c35ce99..ab81e2f37a2b5 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.types
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.types
@@ -31,7 +31,7 @@ declare function require(name: string): any;
=== tests/cases/conformance/salsa/mod1.js ===
///
module.exports = 1
->module.exports = 1 : 1
+>module.exports = 1 : typeof import("tests/cases/conformance/salsa/mod1")
>module.exports : typeof import("tests/cases/conformance/salsa/mod1")
>module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
>exports : typeof import("tests/cases/conformance/salsa/mod1")
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment3.symbols b/tests/baselines/reference/moduleExportWithExportPropertyAssignment3.symbols
index 4f14c045d6462..eb752a5620d26 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment3.symbols
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment3.symbols
@@ -41,13 +41,14 @@ declare function require(name: string): any;
=== tests/cases/conformance/salsa/mod1.js ===
///
module.exports.bothBefore = 'string'
+>module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0))
>module.exports : Symbol(bothBefore, Decl(mod1.js, 0, 0))
->module : Symbol(module, Decl(requires.d.ts, 0, 11))
->exports : Symbol(exports, Decl(requires.d.ts, 0, 21))
+>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
>bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0))
module.exports = {
->module.exports : Symbol(exports, Decl(requires.d.ts, 0, 21))
+>module.exports : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
>module : Symbol(export=, Decl(mod1.js, 1, 36))
>exports : Symbol(export=, Decl(mod1.js, 1, 36))
@@ -61,14 +62,16 @@ module.exports = {
>bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18))
}
module.exports.bothAfter = 'string'
+>module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 6, 1))
>module.exports : Symbol(bothAfter, Decl(mod1.js, 6, 1))
->module : Symbol(module, Decl(requires.d.ts, 0, 11))
->exports : Symbol(exports, Decl(requires.d.ts, 0, 21))
+>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
>bothAfter : Symbol(bothAfter, Decl(mod1.js, 6, 1))
module.exports.justProperty = 'string'
+>module.exports.justProperty : Symbol(justProperty, Decl(mod1.js, 7, 35))
>module.exports : Symbol(justProperty, Decl(mod1.js, 7, 35))
->module : Symbol(module, Decl(requires.d.ts, 0, 11))
->exports : Symbol(exports, Decl(requires.d.ts, 0, 21))
+>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
>justProperty : Symbol(justProperty, Decl(mod1.js, 7, 35))
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment3.types b/tests/baselines/reference/moduleExportWithExportPropertyAssignment3.types
index 4d14bf647fd2c..1f44288644e3f 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment3.types
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment3.types
@@ -50,18 +50,18 @@ declare function require(name: string): any;
///
module.exports.bothBefore = 'string'
>module.exports.bothBefore = 'string' : "string"
->module.exports.bothBefore : any
->module.exports : any
->module : { exports: any; }
->exports : any
->bothBefore : any
+>module.exports.bothBefore : string
+>module.exports : typeof import("tests/cases/conformance/salsa/mod1")
+>module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
+>exports : typeof import("tests/cases/conformance/salsa/mod1")
+>bothBefore : string
>'string' : "string"
module.exports = {
->module.exports = { justExport: 1, bothBefore: 2, bothAfter: 3,} : { [x: string]: any; justExport: number; bothBefore: number; bothAfter: number; }
->module.exports : any
->module : { exports: any; }
->exports : any
+>module.exports = { justExport: 1, bothBefore: 2, bothAfter: 3,} : typeof import("tests/cases/conformance/salsa/mod1")
+>module.exports : typeof import("tests/cases/conformance/salsa/mod1")
+>module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
+>exports : typeof import("tests/cases/conformance/salsa/mod1")
>{ justExport: 1, bothBefore: 2, bothAfter: 3,} : { [x: string]: any; justExport: number; bothBefore: number; bothAfter: number; }
justExport: 1,
@@ -78,19 +78,19 @@ module.exports = {
}
module.exports.bothAfter = 'string'
>module.exports.bothAfter = 'string' : "string"
->module.exports.bothAfter : any
->module.exports : any
->module : { exports: any; }
->exports : any
->bothAfter : any
+>module.exports.bothAfter : string
+>module.exports : typeof import("tests/cases/conformance/salsa/mod1")
+>module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
+>exports : typeof import("tests/cases/conformance/salsa/mod1")
+>bothAfter : string
>'string' : "string"
module.exports.justProperty = 'string'
>module.exports.justProperty = 'string' : "string"
->module.exports.justProperty : any
->module.exports : any
->module : { exports: any; }
->exports : any
->justProperty : any
+>module.exports.justProperty : string
+>module.exports : typeof import("tests/cases/conformance/salsa/mod1")
+>module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
+>exports : typeof import("tests/cases/conformance/salsa/mod1")
+>justProperty : string
>'string' : "string"
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.symbols b/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.symbols
index 400885f4bd9cc..64ae9d8dcb400 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.symbols
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.symbols
@@ -41,9 +41,10 @@ declare function require(name: string): any;
=== tests/cases/conformance/salsa/mod1.js ===
///
module.exports.bothBefore = 'string'
+>module.exports.bothBefore : Symbol(A.bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0))
>module.exports : Symbol(A.bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0))
->module : Symbol(module, Decl(requires.d.ts, 0, 11))
->exports : Symbol(exports, Decl(requires.d.ts, 0, 21))
+>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
>bothBefore : Symbol(A.bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0))
A.justExport = 4
@@ -62,7 +63,7 @@ A.bothAfter = 3
>bothAfter : Symbol(A.bothAfter, Decl(mod1.js, 3, 16))
module.exports = A
->module.exports : Symbol(exports, Decl(requires.d.ts, 0, 21))
+>module.exports : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
>module : Symbol(export=, Decl(mod1.js, 4, 15))
>exports : Symbol(export=, Decl(mod1.js, 4, 15))
>A : Symbol(A, Decl(mod1.js, 5, 18))
@@ -74,14 +75,16 @@ function A() {
>p : Symbol(A.p, Decl(mod1.js, 6, 14))
}
module.exports.bothAfter = 'string'
+>module.exports.bothAfter : Symbol(A.bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1))
>module.exports : Symbol(A.bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1))
->module : Symbol(module, Decl(requires.d.ts, 0, 11))
->exports : Symbol(exports, Decl(requires.d.ts, 0, 21))
+>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
>bothAfter : Symbol(A.bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1))
module.exports.justProperty = 'string'
+>module.exports.justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35))
>module.exports : Symbol(justProperty, Decl(mod1.js, 9, 35))
->module : Symbol(module, Decl(requires.d.ts, 0, 11))
->exports : Symbol(exports, Decl(requires.d.ts, 0, 21))
+>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
>justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35))
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.types b/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.types
index f339118bf05ac..2d0a715b6ce00 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.types
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.types
@@ -50,11 +50,11 @@ declare function require(name: string): any;
///
module.exports.bothBefore = 'string'
>module.exports.bothBefore = 'string' : "string"
->module.exports.bothBefore : any
->module.exports : any
->module : { exports: any; }
->exports : any
->bothBefore : any
+>module.exports.bothBefore : string | number
+>module.exports : typeof import("tests/cases/conformance/salsa/mod1")
+>module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
+>exports : typeof import("tests/cases/conformance/salsa/mod1")
+>bothBefore : string | number
>'string' : "string"
A.justExport = 4
@@ -79,10 +79,10 @@ A.bothAfter = 3
>3 : 3
module.exports = A
->module.exports = A : typeof A
->module.exports : any
->module : { exports: any; }
->exports : any
+>module.exports = A : typeof import("tests/cases/conformance/salsa/mod1")
+>module.exports : typeof import("tests/cases/conformance/salsa/mod1")
+>module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
+>exports : typeof import("tests/cases/conformance/salsa/mod1")
>A : typeof A
function A() {
@@ -97,19 +97,19 @@ function A() {
}
module.exports.bothAfter = 'string'
>module.exports.bothAfter = 'string' : "string"
->module.exports.bothAfter : any
->module.exports : any
->module : { exports: any; }
->exports : any
->bothAfter : any
+>module.exports.bothAfter : string | number
+>module.exports : typeof import("tests/cases/conformance/salsa/mod1")
+>module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
+>exports : typeof import("tests/cases/conformance/salsa/mod1")
+>bothAfter : string | number
>'string' : "string"
module.exports.justProperty = 'string'
>module.exports.justProperty = 'string' : "string"
->module.exports.justProperty : any
->module.exports : any
->module : { exports: any; }
->exports : any
->justProperty : any
+>module.exports.justProperty : string
+>module.exports : typeof import("tests/cases/conformance/salsa/mod1")
+>module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
+>exports : typeof import("tests/cases/conformance/salsa/mod1")
+>justProperty : string
>'string' : "string"
diff --git a/tests/baselines/reference/paramTagTypeResolution.types b/tests/baselines/reference/paramTagTypeResolution.types
index ac81a46fd45b8..f38d11421c3d3 100644
--- a/tests/baselines/reference/paramTagTypeResolution.types
+++ b/tests/baselines/reference/paramTagTypeResolution.types
@@ -18,7 +18,7 @@ f(1, n => { })
* @param {(t: T) => void} k
*/
module.exports = function (x, k) { return k(x) }
->module.exports = function (x, k) { return k(x) } : (x: T, k: (t: T) => void) => void
+>module.exports = function (x, k) { return k(x) } : typeof import("tests/cases/conformance/jsdoc/first")
>module.exports : typeof import("tests/cases/conformance/jsdoc/first")
>module : { "tests/cases/conformance/jsdoc/first": typeof import("tests/cases/conformance/jsdoc/first"); }
>exports : typeof import("tests/cases/conformance/jsdoc/first")
diff --git a/tests/baselines/reference/typeFromPropertyAssignment17.types b/tests/baselines/reference/typeFromPropertyAssignment17.types
index 754cd70f21a7f..eff1e14ebe618 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment17.types
+++ b/tests/baselines/reference/typeFromPropertyAssignment17.types
@@ -43,7 +43,7 @@ declare var module: any;
=== tests/cases/conformance/salsa/minimatch.js ===
///
module.exports = minimatch
->module.exports = minimatch : { (): void; M: typeof M; filter: () => void; }
+>module.exports = minimatch : typeof import("tests/cases/conformance/salsa/minimatch")
>module.exports : typeof import("tests/cases/conformance/salsa/minimatch")
>module : { "tests/cases/conformance/salsa/minimatch": typeof import("tests/cases/conformance/salsa/minimatch"); }
>exports : typeof import("tests/cases/conformance/salsa/minimatch")
diff --git a/tests/baselines/reference/typeFromPropertyAssignment19.types b/tests/baselines/reference/typeFromPropertyAssignment19.types
index 9ddd0735bce61..6c27236b929cf 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment19.types
+++ b/tests/baselines/reference/typeFromPropertyAssignment19.types
@@ -24,9 +24,9 @@ declare var module: any;
=== tests/cases/conformance/salsa/semver.js ===
///
exports = module.exports = C
->exports = module.exports = C : typeof C
+>exports = module.exports = C : typeof import("tests/cases/conformance/salsa/semver")
>exports : typeof import("tests/cases/conformance/salsa/semver")
->module.exports = C : typeof C
+>module.exports = C : typeof import("tests/cases/conformance/salsa/semver")
>module.exports : typeof import("tests/cases/conformance/salsa/semver")
>module : { "tests/cases/conformance/salsa/semver": typeof import("tests/cases/conformance/salsa/semver"); }
>exports : typeof import("tests/cases/conformance/salsa/semver")
diff --git a/tests/baselines/reference/typedefCrossModule.types b/tests/baselines/reference/typedefCrossModule.types
index eb8dcae587742..681da8e9b4cd7 100644
--- a/tests/baselines/reference/typedefCrossModule.types
+++ b/tests/baselines/reference/typedefCrossModule.types
@@ -9,7 +9,7 @@ declare var module: { exports: any};
/** @typedef {{ type: "b", y: 1 }} B */
/** @typedef {A | B} Both */
module.exports = C
->module.exports = C : typeof C
+>module.exports = C : typeof import("tests/cases/conformance/jsdoc/mod1")
>module.exports : typeof import("tests/cases/conformance/jsdoc/mod1")
>module : { "tests/cases/conformance/jsdoc/mod1": typeof import("tests/cases/conformance/jsdoc/mod1"); }
>exports : typeof import("tests/cases/conformance/jsdoc/mod1")
diff --git a/tests/baselines/reference/typedefCrossModule2.symbols b/tests/baselines/reference/typedefCrossModule2.symbols
index b2143e14aa4fb..5e080e66c0308 100644
--- a/tests/baselines/reference/typedefCrossModule2.symbols
+++ b/tests/baselines/reference/typedefCrossModule2.symbols
@@ -33,6 +33,7 @@ exports.Bar = class { }
/** @typedef {number} Baz */
module.exports = {
+>module.exports : Symbol("tests/cases/conformance/jsdoc/mod1", Decl(mod1.js, 0, 0))
>module : Symbol(export=, Decl(mod1.js, 6, 23), Decl(mod1.js, 19, 17))
>exports : Symbol(export=, Decl(mod1.js, 6, 23), Decl(mod1.js, 19, 17))
@@ -54,6 +55,7 @@ exports.Quid = 2;
/** @typedef {number} Quack */
module.exports = {
+>module.exports : Symbol("tests/cases/conformance/jsdoc/mod1", Decl(mod1.js, 0, 0))
>module : Symbol(export=, Decl(mod1.js, 6, 23), Decl(mod1.js, 19, 17))
>exports : Symbol(export=, Decl(mod1.js, 6, 23), Decl(mod1.js, 19, 17))
diff --git a/tests/baselines/reference/typedefCrossModule2.types b/tests/baselines/reference/typedefCrossModule2.types
index 67e4b7a4e890e..1a918b5a8c68d 100644
--- a/tests/baselines/reference/typedefCrossModule2.types
+++ b/tests/baselines/reference/typedefCrossModule2.types
@@ -37,10 +37,10 @@ exports.Bar = class { }
/** @typedef {number} Baz */
module.exports = {
->module.exports = { Baz: class { }} : { [x: string]: any; Baz: typeof Baz; }
->module.exports : any
->module : any
->exports : any
+>module.exports = { Baz: class { }} : typeof import("tests/cases/conformance/jsdoc/mod1")
+>module.exports : typeof import("tests/cases/conformance/jsdoc/mod1")
+>module : { "tests/cases/conformance/jsdoc/mod1": typeof import("tests/cases/conformance/jsdoc/mod1"); }
+>exports : typeof import("tests/cases/conformance/jsdoc/mod1")
>{ Baz: class { }} : { [x: string]: any; Baz: typeof Baz; }
Baz: class { }
@@ -65,10 +65,10 @@ exports.Quid = 2;
/** @typedef {number} Quack */
module.exports = {
->module.exports = { Quack: 2} : { [x: string]: any; Quack: number; }
->module.exports : any
->module : any
->exports : any
+>module.exports = { Quack: 2} : typeof import("tests/cases/conformance/jsdoc/mod1")
+>module.exports : typeof import("tests/cases/conformance/jsdoc/mod1")
+>module : { "tests/cases/conformance/jsdoc/mod1": typeof import("tests/cases/conformance/jsdoc/mod1"); }
+>exports : typeof import("tests/cases/conformance/jsdoc/mod1")
>{ Quack: 2} : { [x: string]: any; Quack: number; }
Quack: 2
diff --git a/tests/baselines/reference/typedefCrossModule3.types b/tests/baselines/reference/typedefCrossModule3.types
index 201c692c6c626..39155091cf56b 100644
--- a/tests/baselines/reference/typedefCrossModule3.types
+++ b/tests/baselines/reference/typedefCrossModule3.types
@@ -12,7 +12,7 @@ ns.Foo = class {}
>class {} : typeof Foo
module.exports = ns;
->module.exports = ns : typeof ns
+>module.exports = ns : typeof import("tests/cases/conformance/jsdoc/mod2")
>module.exports : typeof import("tests/cases/conformance/jsdoc/mod2")
>module : { "tests/cases/conformance/jsdoc/mod2": typeof import("tests/cases/conformance/jsdoc/mod2"); }
>exports : typeof import("tests/cases/conformance/jsdoc/mod2")
diff --git a/tests/baselines/reference/typedefCrossModule4.types b/tests/baselines/reference/typedefCrossModule4.types
index 02c7efb70f563..c685392543a83 100644
--- a/tests/baselines/reference/typedefCrossModule4.types
+++ b/tests/baselines/reference/typedefCrossModule4.types
@@ -4,7 +4,7 @@ class Bar { }
>Bar : Bar
module.exports = { Foo: Bar };
->module.exports = { Foo: Bar } : { [x: string]: any; Foo: typeof Bar; }
+>module.exports = { Foo: Bar } : typeof import("tests/cases/conformance/jsdoc/mod3")
>module.exports : typeof import("tests/cases/conformance/jsdoc/mod3")
>module : { "tests/cases/conformance/jsdoc/mod3": typeof import("tests/cases/conformance/jsdoc/mod3"); }
>exports : typeof import("tests/cases/conformance/jsdoc/mod3")
From e17f98a3974707e93f88232de8dfa7e3a811e5df Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Tue, 17 Jul 2018 12:46:29 -0700
Subject: [PATCH 06/16] Fix lint and accept good user baselines
---
src/compiler/checker.ts | 2 +-
.../reference/user/adonis-framework.log | 12 ++++++
tests/baselines/reference/user/assert.log | 42 ++++---------------
3 files changed, 22 insertions(+), 34 deletions(-)
diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts
index ca1dcc4c74ae2..2de6b6681454b 100644
--- a/src/compiler/checker.ts
+++ b/src/compiler/checker.ts
@@ -4991,7 +4991,7 @@ namespace ts {
return links.type = anyType;
}
if (getCheckFlags(symbol) & CheckFlags.ModuleExports) {
- const fileSymbol = getSymbolOfNode(getSourceFileOfNode(symbol.valueDeclaration))
+ const fileSymbol = getSymbolOfNode(getSourceFileOfNode(symbol.valueDeclaration));
const members = createSymbolTable();
members.set("exports" as __String, fileSymbol);
return links.type = createAnonymousType(symbol, members, emptyArray, emptyArray, undefined, undefined);
diff --git a/tests/baselines/reference/user/adonis-framework.log b/tests/baselines/reference/user/adonis-framework.log
index b805c3a0515b7..09d621aa9aae3 100644
--- a/tests/baselines/reference/user/adonis-framework.log
+++ b/tests/baselines/reference/user/adonis-framework.log
@@ -65,6 +65,15 @@ node_modules/adonis-framework/src/File/index.js(273,5): error TS2322: Type 'bool
Type '""' is not assignable to type 'boolean'.
node_modules/adonis-framework/src/Helpers/index.js(105,3): error TS2322: Type 'null' is not assignable to type 'string'.
node_modules/adonis-framework/src/Helpers/index.js(106,3): error TS2322: Type 'null' is not assignable to type 'string'.
+node_modules/adonis-framework/src/Helpers/index.js(164,10): error TS2554: Expected 3 arguments, but got 2.
+node_modules/adonis-framework/src/Helpers/index.js(178,45): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
+ Type 'undefined' is not assignable to type 'string'.
+node_modules/adonis-framework/src/Helpers/index.js(224,45): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
+ Type 'undefined' is not assignable to type 'string'.
+node_modules/adonis-framework/src/Helpers/index.js(240,45): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
+ Type 'undefined' is not assignable to type 'string'.
+node_modules/adonis-framework/src/Helpers/index.js(256,45): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
+ Type 'undefined' is not assignable to type 'string'.
node_modules/adonis-framework/src/Helpers/index.js(330,23): error TS2532: Object is possibly 'undefined'.
node_modules/adonis-framework/src/Middleware/index.js(13,21): error TS2307: Cannot find module 'adonis-fold'.
node_modules/adonis-framework/src/Middleware/index.js(92,19): error TS2538: Type 'undefined' cannot be used as an index type.
@@ -107,6 +116,9 @@ node_modules/adonis-framework/src/Route/helpers.js(54,21): error TS8024: JSDoc '
node_modules/adonis-framework/src/Route/helpers.js(131,21): error TS8024: JSDoc '@param' tag has name 'format', but there is no parameter with that name.
node_modules/adonis-framework/src/Route/index.js(30,5): error TS2322: Type 'null' is not assignable to type 'string'.
node_modules/adonis-framework/src/Route/index.js(58,3): error TS2322: Type 'null' is not assignable to type 'string'.
+node_modules/adonis-framework/src/Route/index.js(101,21): error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'string'.
+node_modules/adonis-framework/src/Route/index.js(259,21): error TS2345: Argument of type 'any[]' is not assignable to parameter of type 'string'.
+node_modules/adonis-framework/src/Route/index.js(280,21): error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'string'.
node_modules/adonis-framework/src/Route/index.js(321,13): error TS2304: Cannot find name 'Mixed'.
node_modules/adonis-framework/src/Route/index.js(321,20): error TS8029: JSDoc '@param' tag has name 'keys', but there is no parameter with that name. It would match 'arguments' if it had an array type.
node_modules/adonis-framework/src/Route/index.js(354,20): error TS2694: Namespace 'Route' has no exported member 'Group'.
diff --git a/tests/baselines/reference/user/assert.log b/tests/baselines/reference/user/assert.log
index d2498d0949a87..2038217a29d56 100644
--- a/tests/baselines/reference/user/assert.log
+++ b/tests/baselines/reference/user/assert.log
@@ -1,38 +1,14 @@
Exit Code: 1
Standard output:
-node_modules/assert/assert.js(123,8): error TS2339: Property 'AssertionError' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(124,8): error TS2540: Cannot assign to 'name' because it is a constant or a read-only property.
-node_modules/assert/assert.js(125,8): error TS2339: Property 'actual' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(126,8): error TS2339: Property 'expected' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(127,8): error TS2339: Property 'operator' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(129,10): error TS2339: Property 'message' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(130,10): error TS2339: Property 'generatedMessage' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(132,10): error TS2339: Property 'message' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(133,10): error TS2339: Property 'generatedMessage' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(154,12): error TS2339: Property 'stack' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(160,22): error TS2339: Property 'AssertionError' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(195,20): error TS2339: Property 'AssertionError' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(205,8): error TS2339: Property 'fail' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(215,55): error TS2339: Property 'ok' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(217,8): error TS2339: Property 'ok' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(223,8): error TS2339: Property 'equal' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(224,72): error TS2339: Property 'equal' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(230,8): error TS2339: Property 'notEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(232,50): error TS2339: Property 'notEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(239,8): error TS2339: Property 'deepEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(241,57): error TS2339: Property 'deepEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(245,8): error TS2339: Property 'deepStrictEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(247,63): error TS2339: Property 'deepStrictEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(366,8): error TS2339: Property 'notDeepEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(368,60): error TS2339: Property 'notDeepEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(372,8): error TS2339: Property 'notDeepStrictEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(383,8): error TS2339: Property 'strictEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(385,51): error TS2339: Property 'strictEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(392,8): error TS2339: Property 'notStrictEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(394,51): error TS2339: Property 'notStrictEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(473,8): error TS2339: Property 'throws' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(478,8): error TS2339: Property 'doesNotThrow' does not exist on type '(value: any, message: any) => void'.
-node_modules/assert/assert.js(482,8): error TS2339: Property 'ifError' does not exist on type '(value: any, message: any) => void'.
+node_modules/assert/assert.js(124,8): error TS2339: Property 'name' does not exist on type 'typeof import("/assert/node_modules/assert/assert")'.
+node_modules/assert/assert.js(125,8): error TS2339: Property 'actual' does not exist on type 'typeof import("/assert/node_modules/assert/assert")'.
+node_modules/assert/assert.js(126,8): error TS2339: Property 'expected' does not exist on type 'typeof import("/assert/node_modules/assert/assert")'.
+node_modules/assert/assert.js(127,8): error TS2339: Property 'operator' does not exist on type 'typeof import("/assert/node_modules/assert/assert")'.
+node_modules/assert/assert.js(129,10): error TS2339: Property 'message' does not exist on type 'typeof import("/assert/node_modules/assert/assert")'.
+node_modules/assert/assert.js(130,10): error TS2339: Property 'generatedMessage' does not exist on type 'typeof import("/assert/node_modules/assert/assert")'.
+node_modules/assert/assert.js(132,10): error TS2339: Property 'message' does not exist on type 'typeof import("/assert/node_modules/assert/assert")'.
+node_modules/assert/assert.js(133,10): error TS2339: Property 'generatedMessage' does not exist on type 'typeof import("/assert/node_modules/assert/assert")'.
+node_modules/assert/assert.js(154,12): error TS2339: Property 'stack' does not exist on type 'typeof import("/assert/node_modules/assert/assert")'.
node_modules/assert/test.js(25,5): error TS2367: This condition will always return 'false' since the types 'string | undefined' and 'boolean' have no overlap.
node_modules/assert/test.js(39,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'?
node_modules/assert/test.js(55,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'?
From aba56b84bf7595712121d37cba6997d2f87a7f52 Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Tue, 17 Jul 2018 14:28:02 -0700
Subject: [PATCH 07/16] Add tests based on user tests.
These currently fail.
---
.../conformance/salsa/moduleExportAssignment.ts | 17 +++++++++++++++++
.../salsa/moduleExportAssignment2.ts | 10 ++++++++++
.../salsa/moduleExportAssignment3.ts | 10 ++++++++++
.../moduleExportPropertyAssignmentDefault.ts | 8 ++++++++
4 files changed, 45 insertions(+)
create mode 100644 tests/cases/conformance/salsa/moduleExportAssignment.ts
create mode 100644 tests/cases/conformance/salsa/moduleExportAssignment2.ts
create mode 100644 tests/cases/conformance/salsa/moduleExportAssignment3.ts
create mode 100644 tests/cases/conformance/salsa/moduleExportPropertyAssignmentDefault.ts
diff --git a/tests/cases/conformance/salsa/moduleExportAssignment.ts b/tests/cases/conformance/salsa/moduleExportAssignment.ts
new file mode 100644
index 0000000000000..b558020d3abf6
--- /dev/null
+++ b/tests/cases/conformance/salsa/moduleExportAssignment.ts
@@ -0,0 +1,17 @@
+// @noEmit: true
+// @allowJs: true
+// @checkJs: true
+// @Filename: npmlog.js
+class EE {
+ /** @param {string} s */
+ on(s) { }
+}
+var npmlog = module.exports = new EE()
+
+npmlog.on('hi') // both references should see EE.on
+module.exports.on('hi') // here too
+
+npmlog.x = 1
+module.exports.y = 2
+npmlog.y
+module.exports.x
diff --git a/tests/cases/conformance/salsa/moduleExportAssignment2.ts b/tests/cases/conformance/salsa/moduleExportAssignment2.ts
new file mode 100644
index 0000000000000..decb27392126c
--- /dev/null
+++ b/tests/cases/conformance/salsa/moduleExportAssignment2.ts
@@ -0,0 +1,10 @@
+// @noEmit: true
+// @allowJs: true
+// @checkJs: true
+// @Filename: npm.js
+var npm = module.exports = function (tree) {
+}
+module.exports.asReadInstalled = function (tree) {
+ npm(tree) // both references should be callable
+ module.exports(tree)
+}
diff --git a/tests/cases/conformance/salsa/moduleExportAssignment3.ts b/tests/cases/conformance/salsa/moduleExportAssignment3.ts
new file mode 100644
index 0000000000000..ca45a720c3041
--- /dev/null
+++ b/tests/cases/conformance/salsa/moduleExportAssignment3.ts
@@ -0,0 +1,10 @@
+// @noEmit: true
+// @allowJs: true
+// @checkJs: true
+// @Filename: mod.js
+module.exports = function x() { }
+module.exports() // should be callable
+
+// @Filename: npm.js
+var mod = require('./mod')
+mod() // should be callable from here too
diff --git a/tests/cases/conformance/salsa/moduleExportPropertyAssignmentDefault.ts b/tests/cases/conformance/salsa/moduleExportPropertyAssignmentDefault.ts
new file mode 100644
index 0000000000000..f61442bcd9ad0
--- /dev/null
+++ b/tests/cases/conformance/salsa/moduleExportPropertyAssignmentDefault.ts
@@ -0,0 +1,8 @@
+// @noEmit: true
+// @allowJs: true
+// @checkJs: true
+// @Filename: axios.js
+
+var axios = {}
+module.exports = axios // both assignments should be ok
+module.exports.default = axios
From bb225c5943e61c13c080f0971ed89e4a35e8b74d Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Thu, 19 Jul 2018 08:13:28 -0700
Subject: [PATCH 08/16] Fix all but 1 of user test bugs found by typing
module.exports
Still quite messy and full of notes
---
src/compiler/checker.ts | 33 +++++--
.../reference/callbackCrossModule.types | 8 +-
.../checkJsTypeDefNoUnusedLocalMarked.types | 8 +-
.../reference/constructorFunctions2.types | 8 +-
...ontextualTypedSpecialAssignment.errors.txt | 85 -------------------
.../contextualTypedSpecialAssignment.types | 16 ++--
.../reference/javascriptCommonjsModule.types | 8 +-
...PropertyInitalizationInObjectLiteral.types | 8 +-
.../baselines/reference/jsdocImportType.types | 8 +-
.../reference/jsdocImportType2.types | 8 +-
.../reference/moduleExportAlias2.symbols | 2 +-
.../reference/moduleExportAlias2.types | 14 +--
.../reference/moduleExportAlias3.types | 8 +-
.../reference/moduleExportAlias4.symbols | 2 +-
.../reference/moduleExportAlias4.types | 14 +--
.../reference/moduleExportAlias5.types | 14 +--
.../reference/moduleExportAssignment2.symbols | 27 ++++++
.../reference/moduleExportAssignment2.types | 33 +++++++
.../reference/moduleExportAssignment3.symbols | 21 +++++
.../reference/moduleExportAssignment3.types | 26 ++++++
...uleExportPropertyAssignmentDefault.symbols | 18 ++++
...oduleExportPropertyAssignmentDefault.types | 21 +++++
...ExportWithExportPropertyAssignment.symbols | 2 +-
...leExportWithExportPropertyAssignment.types | 14 +--
...rtWithExportPropertyAssignment2.errors.txt | 5 +-
...xportWithExportPropertyAssignment2.symbols | 1 -
...eExportWithExportPropertyAssignment2.types | 18 ++--
...xportWithExportPropertyAssignment3.symbols | 6 +-
...eExportWithExportPropertyAssignment3.types | 34 ++++----
...xportWithExportPropertyAssignment4.symbols | 6 +-
...eExportWithExportPropertyAssignment4.types | 26 +++---
.../reference/paramTagTypeResolution.types | 8 +-
.../typeFromPropertyAssignment17.types | 8 +-
.../typeFromPropertyAssignment19.types | 12 +--
.../reference/typedefCrossModule.types | 8 +-
.../reference/typedefCrossModule2.types | 20 ++---
.../reference/typedefCrossModule3.types | 8 +-
.../reference/typedefCrossModule4.types | 8 +-
38 files changed, 327 insertions(+), 247 deletions(-)
delete mode 100644 tests/baselines/reference/contextualTypedSpecialAssignment.errors.txt
create mode 100644 tests/baselines/reference/moduleExportAssignment2.symbols
create mode 100644 tests/baselines/reference/moduleExportAssignment2.types
create mode 100644 tests/baselines/reference/moduleExportAssignment3.symbols
create mode 100644 tests/baselines/reference/moduleExportAssignment3.types
create mode 100644 tests/baselines/reference/moduleExportPropertyAssignmentDefault.symbols
create mode 100644 tests/baselines/reference/moduleExportPropertyAssignmentDefault.types
diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts
index 2de6b6681454b..4564368ba6e2d 100644
--- a/src/compiler/checker.ts
+++ b/src/compiler/checker.ts
@@ -2413,7 +2413,7 @@ namespace ts {
function getExportsOfModuleWorker(moduleSymbol: Symbol): SymbolTable {
const visitedSymbols: Symbol[] = [];
- // A module defined by an 'export=' consists on one export that needs to be resolved
+ // A module defined by an 'export=' consists of one export that needs to be resolved
moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);
return visit(moduleSymbol) || emptySymbols;
@@ -4713,7 +4713,7 @@ namespace ts {
return undefined;
}
- function getWidenedTypeFromJSSpecialPropertyDeclarations(symbol: Symbol) {
+ function getWidenedTypeFromJSSpecialPropertyDeclarations(symbol: Symbol, aliased: Symbol) {
// function/class/{} assignments are fresh declarations, not property assignments, so only add prototype assignments
const specialDeclaration = getAssignedJavascriptInitializer(symbol.valueDeclaration);
if (specialDeclaration) {
@@ -4769,7 +4769,7 @@ namespace ts {
}
else if (!jsDocType && isBinaryExpression(expression)) {
// If we don't have an explicit JSDoc type, get the type from the expression.
- let type = getWidenedLiteralType(checkExpressionCached(expression.right));
+ let type = aliased !== symbol ? getTypeOfSymbol(aliased) : getWidenedLiteralType(checkExpressionCached(expression.right));
if (getObjectFlags(type) & ObjectFlags.Anonymous &&
special === SpecialPropertyAssignmentKind.ModuleExports &&
@@ -4777,7 +4777,7 @@ namespace ts {
const exportedType = resolveStructuredTypeMembers(type as AnonymousType);
const members = createSymbolTable();
copyEntries(exportedType.members, members);
- symbol.exports!.forEach((s, name) => {
+ (aliased !== symbol ? aliased : symbol).exports!.forEach((s, name) => {
if (members.has(name)) {
const exportedMember = exportedType.members.get(name)!;
const union = createSymbol(s.flags | exportedMember.flags, name);
@@ -5076,7 +5076,7 @@ namespace ts {
else if (isBinaryExpression(decl) ||
isPropertyAccessExpression(decl) && isBinaryExpression(decl.parent)) {
return getJSInitializerType(decl, symbol, getAssignedJavascriptInitializer(isBinaryExpression(decl) ? decl.left : decl)) ||
- getWidenedTypeFromJSSpecialPropertyDeclarations(symbol);
+ getWidenedTypeFromJSSpecialPropertyDeclarations(symbol, symbol);
}
else if (isParameter(decl)
|| isPropertyDeclaration(decl)
@@ -5226,9 +5226,26 @@ namespace ts {
}
else if (symbol.valueDeclaration.kind === SyntaxKind.BinaryExpression ||
symbol.valueDeclaration.kind === SyntaxKind.PropertyAccessExpression && symbol.valueDeclaration.parent.kind === SyntaxKind.BinaryExpression) {
- links.type = getWidenedTypeFromJSSpecialPropertyDeclarations(symbol);
+ links.type = getWidenedTypeFromJSSpecialPropertyDeclarations(symbol, symbol);
}
else {
+ if (symbol.flags & SymbolFlags.ValueModule && symbol.valueDeclaration && isSourceFile(symbol.valueDeclaration) && symbol.valueDeclaration.commonJsModuleIndicator) {
+ // symbol.exports && symbol.exports.get(InternalSymbolName.ExportEquals) && symbol.exports.get(InternalSymbolName.ExportEquals)!.valueDeclaration && isBinaryExpression(symbol.exports.get(InternalSymbolName.ExportEquals)!.valueDeclaration)) {
+
+ const resolvedModule = resolveExternalModuleSymbol(symbol);
+ if (resolvedModule !== symbol) {
+ const original = symbol.exports!.get(InternalSymbolName.ExportEquals)!;
+ // TODO: Maybe call this in resolveModuleFromTypeLiteral or whatever (the weird webpack example now works better than the alternative)
+ // (or boost the ability of getTypeOfSymbol [Property case] to recognise artificially augmented symbols, and then just always call getTypeOfSymbol)
+ let t = getWidenedTypeFromJSSpecialPropertyDeclarations(original, resolvedModule);
+ // TODO: This is probably not needed
+ if (t === errorType) {
+ t = getTypeOfSymbol(resolvedModule);
+ }
+ links.type = t;
+ return links.type;
+ }
+ }
const type = createObjectType(ObjectFlags.Anonymous, symbol);
if (symbol.flags & SymbolFlags.Class) {
const baseTypeVariable = getBaseTypeVariableOfClass(symbol);
@@ -19299,7 +19316,7 @@ namespace ts {
if (node.expression.kind === SyntaxKind.SuperKeyword) {
const superType = checkSuperExpression(node.expression);
if (isTypeAny(superType)) {
- forEach(node.arguments, checkExpresionNoReturn); // Still visit arguments so they get marked for visibility, etc
+ forEach(node.arguments, checkExpressionNoReturn); // Still visit arguments so they get marked for visibility, etc
return anySignature;
}
if (superType !== errorType) {
@@ -21648,7 +21665,7 @@ namespace ts {
return type;
}
- function checkExpresionNoReturn(node: Expression) {
+ function checkExpressionNoReturn(node: Expression) {
checkExpression(node);
}
diff --git a/tests/baselines/reference/callbackCrossModule.types b/tests/baselines/reference/callbackCrossModule.types
index efa2fd7159851..c3f0aabbc0091 100644
--- a/tests/baselines/reference/callbackCrossModule.types
+++ b/tests/baselines/reference/callbackCrossModule.types
@@ -4,10 +4,10 @@
* @return {any} I don't even know what this should return
*/
module.exports = C
->module.exports = C : typeof import("tests/cases/conformance/jsdoc/mod1")
->module.exports : typeof import("tests/cases/conformance/jsdoc/mod1")
->module : { "tests/cases/conformance/jsdoc/mod1": typeof import("tests/cases/conformance/jsdoc/mod1"); }
->exports : typeof import("tests/cases/conformance/jsdoc/mod1")
+>module.exports = C : typeof C
+>module.exports : typeof C
+>module : { "tests/cases/conformance/jsdoc/mod1": typeof C; }
+>exports : typeof C
>C : typeof C
function C() {
diff --git a/tests/baselines/reference/checkJsTypeDefNoUnusedLocalMarked.types b/tests/baselines/reference/checkJsTypeDefNoUnusedLocalMarked.types
index 258a673d6ff6d..e9385a7152df3 100644
--- a/tests/baselines/reference/checkJsTypeDefNoUnusedLocalMarked.types
+++ b/tests/baselines/reference/checkJsTypeDefNoUnusedLocalMarked.types
@@ -22,10 +22,10 @@ export = Foo;
/** @typedef {(foo: Foo) => string} FooFun */
module.exports = /** @type {FooFun} */(void 0);
->module.exports = /** @type {FooFun} */(void 0) : typeof import("tests/cases/compiler/something")
->module.exports : typeof import("tests/cases/compiler/something")
->module : { "tests/cases/compiler/something": typeof import("tests/cases/compiler/something"); }
->exports : typeof import("tests/cases/compiler/something")
+>module.exports = /** @type {FooFun} */(void 0) : (foo: typeof Foo) => string
+>module.exports : (foo: typeof Foo) => string
+>module : { "tests/cases/compiler/something": (foo: typeof Foo) => string; }
+>exports : (foo: typeof Foo) => string
>(void 0) : (foo: typeof Foo) => string
>void 0 : undefined
>0 : 0
diff --git a/tests/baselines/reference/constructorFunctions2.types b/tests/baselines/reference/constructorFunctions2.types
index 09fd9607aaad7..b35b5ce2f2ffe 100644
--- a/tests/baselines/reference/constructorFunctions2.types
+++ b/tests/baselines/reference/constructorFunctions2.types
@@ -69,9 +69,9 @@ function A() { this.id = 1; }
>1 : 1
module.exports = A;
->module.exports = A : typeof import("tests/cases/conformance/salsa/other")
->module.exports : typeof import("tests/cases/conformance/salsa/other")
->module : { "tests/cases/conformance/salsa/other": typeof import("tests/cases/conformance/salsa/other"); }
->exports : typeof import("tests/cases/conformance/salsa/other")
+>module.exports = A : typeof A
+>module.exports : typeof A
+>module : { "tests/cases/conformance/salsa/other": typeof A; }
+>exports : typeof A
>A : typeof A
diff --git a/tests/baselines/reference/contextualTypedSpecialAssignment.errors.txt b/tests/baselines/reference/contextualTypedSpecialAssignment.errors.txt
deleted file mode 100644
index 1c745e2dac563..0000000000000
--- a/tests/baselines/reference/contextualTypedSpecialAssignment.errors.txt
+++ /dev/null
@@ -1,85 +0,0 @@
-tests/cases/conformance/salsa/mod.js(5,7): error TS7006: Parameter 'n' implicitly has an 'any' type.
-
-
-==== tests/cases/conformance/salsa/test.js (0 errors) ====
- /** @typedef {{
- status: 'done'
- m(n: number): void
- }} DoneStatus */
-
- // property assignment
- var ns = {}
- /** @type {DoneStatus} */
- ns.x = {
- status: 'done',
- m(n) { }
- }
-
- ns.x = {
- status: 'done',
- m(n) { }
- }
- ns.x
-
-
- // this-property assignment
- class Thing {
- constructor() {
- /** @type {DoneStatus} */
- this.s = {
- status: 'done',
- m(n) { }
- }
- }
-
- fail() {
- this.s = {
- status: 'done',
- m(n) { }
- }
- }
- }
-
- // exports-property assignment
-
- /** @type {DoneStatus} */
- exports.x = {
- status: "done",
- m(n) { }
- }
- exports.x
-
- /** @type {DoneStatus} */
- module.exports.y = {
- status: "done",
- m(n) { }
- }
- module.exports.y
-
- // prototype-property assignment
- /** @type {DoneStatus} */
- Thing.prototype.x = {
- status: 'done',
- m(n) { }
- }
- Thing.prototype.x
-
- // prototype assignment
- function F() {
- }
- /** @type {DoneStatus} */
- F.prototype = {
- status: "done",
- m(n) { }
- }
-
-==== tests/cases/conformance/salsa/mod.js (1 errors) ====
- // module.exports assignment
- /** @type {{ status: 'done', m(n: number): void }} */
- module.exports = {
- status: "done",
- m(n) { }
- ~
-!!! error TS7006: Parameter 'n' implicitly has an 'any' type.
- }
-
\ No newline at end of file
diff --git a/tests/baselines/reference/contextualTypedSpecialAssignment.types b/tests/baselines/reference/contextualTypedSpecialAssignment.types
index 144a6d8864062..c178799c94dda 100644
--- a/tests/baselines/reference/contextualTypedSpecialAssignment.types
+++ b/tests/baselines/reference/contextualTypedSpecialAssignment.types
@@ -190,18 +190,18 @@ F.prototype = {
// module.exports assignment
/** @type {{ status: 'done', m(n: number): void }} */
module.exports = {
->module.exports = { status: "done", m(n) { }} : typeof import("tests/cases/conformance/salsa/mod")
->module.exports : typeof import("tests/cases/conformance/salsa/mod")
->module : { "tests/cases/conformance/salsa/mod": typeof import("tests/cases/conformance/salsa/mod"); }
->exports : typeof import("tests/cases/conformance/salsa/mod")
->{ status: "done", m(n) { }} : { status: string; m(n: any): void; }
+>module.exports = { status: "done", m(n) { }} : { status: "done"; m(n: number): void; }
+>module.exports : { status: "done"; m(n: number): void; }
+>module : { "tests/cases/conformance/salsa/mod": { status: "done"; m(n: number): void; }; }
+>exports : { status: "done"; m(n: number): void; }
+>{ status: "done", m(n) { }} : { status: "done"; m(n: number): void; }
status: "done",
->status : string
+>status : "done"
>"done" : "done"
m(n) { }
->m : (n: any) => void
->n : any
+>m : (n: number) => void
+>n : number
}
diff --git a/tests/baselines/reference/javascriptCommonjsModule.types b/tests/baselines/reference/javascriptCommonjsModule.types
index 29927cb0a199f..feee6cb3ddf95 100644
--- a/tests/baselines/reference/javascriptCommonjsModule.types
+++ b/tests/baselines/reference/javascriptCommonjsModule.types
@@ -7,9 +7,9 @@ class Bar extends Foo {}
>Foo : Foo
module.exports = Bar;
->module.exports = Bar : typeof import("tests/cases/compiler/index")
->module.exports : typeof import("tests/cases/compiler/index")
->module : { "tests/cases/compiler/index": typeof import("tests/cases/compiler/index"); }
->exports : typeof import("tests/cases/compiler/index")
+>module.exports = Bar : typeof Bar
+>module.exports : typeof Bar
+>module : { "tests/cases/compiler/index": typeof Bar; }
+>exports : typeof Bar
>Bar : typeof Bar
diff --git a/tests/baselines/reference/jsFileClassPropertyInitalizationInObjectLiteral.types b/tests/baselines/reference/jsFileClassPropertyInitalizationInObjectLiteral.types
index 7d178c6e60476..08378166f7c7a 100644
--- a/tests/baselines/reference/jsFileClassPropertyInitalizationInObjectLiteral.types
+++ b/tests/baselines/reference/jsFileClassPropertyInitalizationInObjectLiteral.types
@@ -1,9 +1,9 @@
=== tests/cases/compiler/foo.js ===
module.exports = function () {
->module.exports = function () { class A { } return { c: A.b = 1, }} : typeof import("tests/cases/compiler/foo")
->module.exports : typeof import("tests/cases/compiler/foo")
->module : { "tests/cases/compiler/foo": typeof import("tests/cases/compiler/foo"); }
->exports : typeof import("tests/cases/compiler/foo")
+>module.exports = function () { class A { } return { c: A.b = 1, }} : () => { [x: string]: any; c: number; }
+>module.exports : () => { [x: string]: any; c: number; }
+>module : { "tests/cases/compiler/foo": () => { [x: string]: any; c: number; }; }
+>exports : () => { [x: string]: any; c: number; }
>function () { class A { } return { c: A.b = 1, }} : () => { [x: string]: any; c: number; }
class A { }
diff --git a/tests/baselines/reference/jsdocImportType.types b/tests/baselines/reference/jsdocImportType.types
index 32e5e91bd9a11..a5d3844388a4c 100644
--- a/tests/baselines/reference/jsdocImportType.types
+++ b/tests/baselines/reference/jsdocImportType.types
@@ -52,9 +52,9 @@ class Chunk {
}
}
module.exports = Chunk;
->module.exports = Chunk : typeof import("tests/cases/conformance/jsdoc/mod1")
->module.exports : typeof import("tests/cases/conformance/jsdoc/mod1")
->module : { "tests/cases/conformance/jsdoc/mod1": typeof import("tests/cases/conformance/jsdoc/mod1"); }
->exports : typeof import("tests/cases/conformance/jsdoc/mod1")
+>module.exports = Chunk : typeof Chunk
+>module.exports : typeof Chunk
+>module : { "tests/cases/conformance/jsdoc/mod1": typeof Chunk; }
+>exports : typeof Chunk
>Chunk : typeof Chunk
diff --git a/tests/baselines/reference/jsdocImportType2.types b/tests/baselines/reference/jsdocImportType2.types
index 5efa7faf1f4b5..817b754069aae 100644
--- a/tests/baselines/reference/jsdocImportType2.types
+++ b/tests/baselines/reference/jsdocImportType2.types
@@ -40,10 +40,10 @@ declare var module: { exports: any };
=== tests/cases/conformance/jsdoc/mod1.js ===
///
module.exports = class Chunk {
->module.exports = class Chunk { constructor() { this.chunk = 1; }} : typeof import("tests/cases/conformance/jsdoc/mod1")
->module.exports : typeof import("tests/cases/conformance/jsdoc/mod1")
->module : { "tests/cases/conformance/jsdoc/mod1": typeof import("tests/cases/conformance/jsdoc/mod1"); }
->exports : typeof import("tests/cases/conformance/jsdoc/mod1")
+>module.exports = class Chunk { constructor() { this.chunk = 1; }} : typeof Chunk
+>module.exports : typeof Chunk
+>module : { "tests/cases/conformance/jsdoc/mod1": typeof Chunk; }
+>exports : typeof Chunk
>class Chunk { constructor() { this.chunk = 1; }} : typeof Chunk
>Chunk : typeof Chunk
diff --git a/tests/baselines/reference/moduleExportAlias2.symbols b/tests/baselines/reference/moduleExportAlias2.symbols
index 6dc88d4d8c992..f6ebc315313d7 100644
--- a/tests/baselines/reference/moduleExportAlias2.symbols
+++ b/tests/baselines/reference/moduleExportAlias2.symbols
@@ -37,7 +37,7 @@ exports = module.exports = C
>C : Symbol(C, Decl(semver.js, 2, 22))
exports.f = n => n + 1
->exports.f : Symbol(f, Decl(semver.js, 1, 28))
+>exports.f : Symbol(f)
>exports : Symbol(f, Decl(semver.js, 1, 28))
>f : Symbol(f, Decl(semver.js, 1, 28))
>n : Symbol(n, Decl(semver.js, 2, 11))
diff --git a/tests/baselines/reference/moduleExportAlias2.types b/tests/baselines/reference/moduleExportAlias2.types
index 2d2957c5db4b9..65f245a6f4f32 100644
--- a/tests/baselines/reference/moduleExportAlias2.types
+++ b/tests/baselines/reference/moduleExportAlias2.types
@@ -34,18 +34,18 @@ declare var module: { exports: any };
=== tests/cases/conformance/salsa/semver.js ===
///
exports = module.exports = C
->exports = module.exports = C : typeof import("tests/cases/conformance/salsa/semver")
->exports : typeof import("tests/cases/conformance/salsa/semver")
->module.exports = C : typeof import("tests/cases/conformance/salsa/semver")
->module.exports : typeof import("tests/cases/conformance/salsa/semver")
->module : { "tests/cases/conformance/salsa/semver": typeof import("tests/cases/conformance/salsa/semver"); }
->exports : typeof import("tests/cases/conformance/salsa/semver")
+>exports = module.exports = C : typeof C
+>exports : typeof C
+>module.exports = C : typeof C
+>module.exports : typeof C
+>module : { "tests/cases/conformance/salsa/semver": typeof C; }
+>exports : typeof C
>C : typeof C
exports.f = n => n + 1
>exports.f = n => n + 1 : (n: any) => any
>exports.f : (n: any) => any
->exports : typeof import("tests/cases/conformance/salsa/semver")
+>exports : typeof C
>f : (n: any) => any
>n => n + 1 : (n: any) => any
>n : any
diff --git a/tests/baselines/reference/moduleExportAlias3.types b/tests/baselines/reference/moduleExportAlias3.types
index 88c076d850531..23994aeca175f 100644
--- a/tests/baselines/reference/moduleExportAlias3.types
+++ b/tests/baselines/reference/moduleExportAlias3.types
@@ -4,10 +4,10 @@ class C {
>C : C
}
module.exports = {
->module.exports = { C} : typeof import("tests/cases/conformance/salsa/bug24062")
->module.exports : typeof import("tests/cases/conformance/salsa/bug24062")
->module : { "tests/cases/conformance/salsa/bug24062": typeof import("tests/cases/conformance/salsa/bug24062"); }
->exports : typeof import("tests/cases/conformance/salsa/bug24062")
+>module.exports = { C} : { [x: string]: any; C: typeof C; }
+>module.exports : { [x: string]: any; C: typeof C; }
+>module : { "tests/cases/conformance/salsa/bug24062": { [x: string]: any; C: typeof C; }; }
+>exports : { [x: string]: any; C: typeof C; }
>{ C} : { [x: string]: any; C: typeof C; }
C
diff --git a/tests/baselines/reference/moduleExportAlias4.symbols b/tests/baselines/reference/moduleExportAlias4.symbols
index c13cdd67992f4..d5666acefa19d 100644
--- a/tests/baselines/reference/moduleExportAlias4.symbols
+++ b/tests/baselines/reference/moduleExportAlias4.symbols
@@ -12,7 +12,7 @@ module.exports = class C {}
>C : Symbol(C, Decl(bug24024.js, 2, 16))
module.exports.D = class D { }
->module.exports.D : Symbol(D, Decl(bug24024.js, 2, 27))
+>module.exports.D : Symbol(D)
>module.exports : Symbol(D, Decl(bug24024.js, 2, 27))
>module : Symbol(module)
>exports : Symbol("tests/cases/conformance/salsa/bug24024", Decl(bug24024.js, 0, 0))
diff --git a/tests/baselines/reference/moduleExportAlias4.types b/tests/baselines/reference/moduleExportAlias4.types
index 2bd5bb93ac269..744252781400b 100644
--- a/tests/baselines/reference/moduleExportAlias4.types
+++ b/tests/baselines/reference/moduleExportAlias4.types
@@ -7,19 +7,19 @@ var wat = require('./bug24024')
>'./bug24024' : "./bug24024"
module.exports = class C {}
->module.exports = class C {} : typeof import("tests/cases/conformance/salsa/bug24024")
->module.exports : typeof import("tests/cases/conformance/salsa/bug24024")
->module : { "tests/cases/conformance/salsa/bug24024": typeof import("tests/cases/conformance/salsa/bug24024"); }
->exports : typeof import("tests/cases/conformance/salsa/bug24024")
+>module.exports = class C {} : typeof C
+>module.exports : typeof C
+>module : { "tests/cases/conformance/salsa/bug24024": typeof C; }
+>exports : typeof C
>class C {} : typeof C
>C : typeof C
module.exports.D = class D { }
>module.exports.D = class D { } : typeof D
>module.exports.D : typeof D
->module.exports : typeof import("tests/cases/conformance/salsa/bug24024")
->module : { "tests/cases/conformance/salsa/bug24024": typeof import("tests/cases/conformance/salsa/bug24024"); }
->exports : typeof import("tests/cases/conformance/salsa/bug24024")
+>module.exports : typeof C
+>module : { "tests/cases/conformance/salsa/bug24024": typeof C; }
+>exports : typeof C
>D : typeof D
>class D { } : typeof D
>D : typeof D
diff --git a/tests/baselines/reference/moduleExportAlias5.types b/tests/baselines/reference/moduleExportAlias5.types
index 41b0f013e38dc..b334331c639cd 100644
--- a/tests/baselines/reference/moduleExportAlias5.types
+++ b/tests/baselines/reference/moduleExportAlias5.types
@@ -5,18 +5,18 @@ const webpack = function (){
>function (){} : { (): void; WebpackOptionsDefaulter: number; }
}
exports = module.exports = webpack;
->exports = module.exports = webpack : typeof import("tests/cases/conformance/salsa/bug24754")
->exports : typeof import("tests/cases/conformance/salsa/bug24754")
->module.exports = webpack : typeof import("tests/cases/conformance/salsa/bug24754")
->module.exports : typeof import("tests/cases/conformance/salsa/bug24754")
->module : { "tests/cases/conformance/salsa/bug24754": typeof import("tests/cases/conformance/salsa/bug24754"); }
->exports : typeof import("tests/cases/conformance/salsa/bug24754")
+>exports = module.exports = webpack : { (): void; WebpackOptionsDefaulter: number; version: number; }
+>exports : { (): void; WebpackOptionsDefaulter: number; version: number; }
+>module.exports = webpack : { (): void; WebpackOptionsDefaulter: number; version: number; }
+>module.exports : { (): void; WebpackOptionsDefaulter: number; version: number; }
+>module : { "tests/cases/conformance/salsa/bug24754": { (): void; WebpackOptionsDefaulter: number; version: number; }; }
+>exports : { (): void; WebpackOptionsDefaulter: number; version: number; }
>webpack : { (): void; WebpackOptionsDefaulter: number; }
exports.version = 1001;
>exports.version = 1001 : 1001
>exports.version : number
->exports : typeof import("tests/cases/conformance/salsa/bug24754")
+>exports : { (): void; WebpackOptionsDefaulter: number; version: number; }
>version : number
>1001 : 1001
diff --git a/tests/baselines/reference/moduleExportAssignment2.symbols b/tests/baselines/reference/moduleExportAssignment2.symbols
new file mode 100644
index 0000000000000..2c7bdc586b181
--- /dev/null
+++ b/tests/baselines/reference/moduleExportAssignment2.symbols
@@ -0,0 +1,27 @@
+=== tests/cases/conformance/salsa/npm.js ===
+var npm = module.exports = function (tree) {
+>npm : Symbol(npm, Decl(npm.js, 0, 3))
+>module.exports : Symbol("tests/cases/conformance/salsa/npm", Decl(npm.js, 0, 0))
+>module : Symbol(npm, Decl(npm.js, 0, 9))
+>exports : Symbol(npm, Decl(npm.js, 0, 9))
+>tree : Symbol(tree, Decl(npm.js, 0, 37))
+}
+module.exports.asReadInstalled = function (tree) {
+>module.exports.asReadInstalled : Symbol(asReadInstalled)
+>module.exports : Symbol(asReadInstalled, Decl(npm.js, 1, 1))
+>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/npm", Decl(npm.js, 0, 0))
+>asReadInstalled : Symbol(asReadInstalled, Decl(npm.js, 1, 1))
+>tree : Symbol(tree, Decl(npm.js, 2, 43))
+
+ npm(tree) // both references should be callable
+>npm : Symbol(npm, Decl(npm.js, 0, 3))
+>tree : Symbol(tree, Decl(npm.js, 2, 43))
+
+ module.exports(tree)
+>module.exports : Symbol("tests/cases/conformance/salsa/npm", Decl(npm.js, 0, 0))
+>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/npm", Decl(npm.js, 0, 0))
+>tree : Symbol(tree, Decl(npm.js, 2, 43))
+}
+
diff --git a/tests/baselines/reference/moduleExportAssignment2.types b/tests/baselines/reference/moduleExportAssignment2.types
new file mode 100644
index 0000000000000..1bc1dcb58dc6f
--- /dev/null
+++ b/tests/baselines/reference/moduleExportAssignment2.types
@@ -0,0 +1,33 @@
+=== tests/cases/conformance/salsa/npm.js ===
+var npm = module.exports = function (tree) {
+>npm : { (tree: any): void; asReadInstalled: (tree: any) => void; }
+>module.exports = function (tree) {} : { (tree: any): void; asReadInstalled: (tree: any) => void; }
+>module.exports : { (tree: any): void; asReadInstalled: (tree: any) => void; }
+>module : { "tests/cases/conformance/salsa/npm": { (tree: any): void; asReadInstalled: (tree: any) => void; }; }
+>exports : { (tree: any): void; asReadInstalled: (tree: any) => void; }
+>function (tree) {} : (tree: any) => void
+>tree : any
+}
+module.exports.asReadInstalled = function (tree) {
+>module.exports.asReadInstalled = function (tree) { npm(tree) // both references should be callable module.exports(tree)} : (tree: any) => void
+>module.exports.asReadInstalled : (tree: any) => void
+>module.exports : { (tree: any): void; asReadInstalled: (tree: any) => void; }
+>module : { "tests/cases/conformance/salsa/npm": { (tree: any): void; asReadInstalled: (tree: any) => void; }; }
+>exports : { (tree: any): void; asReadInstalled: (tree: any) => void; }
+>asReadInstalled : (tree: any) => void
+>function (tree) { npm(tree) // both references should be callable module.exports(tree)} : (tree: any) => void
+>tree : any
+
+ npm(tree) // both references should be callable
+>npm(tree) : void
+>npm : { (tree: any): void; asReadInstalled: (tree: any) => void; }
+>tree : any
+
+ module.exports(tree)
+>module.exports(tree) : void
+>module.exports : { (tree: any): void; asReadInstalled: (tree: any) => void; }
+>module : { "tests/cases/conformance/salsa/npm": { (tree: any): void; asReadInstalled: (tree: any) => void; }; }
+>exports : { (tree: any): void; asReadInstalled: (tree: any) => void; }
+>tree : any
+}
+
diff --git a/tests/baselines/reference/moduleExportAssignment3.symbols b/tests/baselines/reference/moduleExportAssignment3.symbols
new file mode 100644
index 0000000000000..d0f2b55b0b41f
--- /dev/null
+++ b/tests/baselines/reference/moduleExportAssignment3.symbols
@@ -0,0 +1,21 @@
+=== tests/cases/conformance/salsa/npm.js ===
+var mod = require('./mod')
+>mod : Symbol(mod, Decl(npm.js, 0, 3))
+>require : Symbol(require)
+>'./mod' : Symbol("tests/cases/conformance/salsa/mod", Decl(mod.js, 0, 0))
+
+mod() // should be callable from here too
+>mod : Symbol(mod, Decl(npm.js, 0, 3))
+
+=== tests/cases/conformance/salsa/mod.js ===
+module.exports = function x() { }
+>module.exports : Symbol("tests/cases/conformance/salsa/mod", Decl(mod.js, 0, 0))
+>module : Symbol(export=, Decl(mod.js, 0, 0))
+>exports : Symbol(export=, Decl(mod.js, 0, 0))
+>x : Symbol(x, Decl(mod.js, 0, 16))
+
+module.exports() // should be callable
+>module.exports : Symbol("tests/cases/conformance/salsa/mod", Decl(mod.js, 0, 0))
+>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/mod", Decl(mod.js, 0, 0))
+
diff --git a/tests/baselines/reference/moduleExportAssignment3.types b/tests/baselines/reference/moduleExportAssignment3.types
new file mode 100644
index 0000000000000..649beaa4ee4de
--- /dev/null
+++ b/tests/baselines/reference/moduleExportAssignment3.types
@@ -0,0 +1,26 @@
+=== tests/cases/conformance/salsa/npm.js ===
+var mod = require('./mod')
+>mod : () => void
+>require('./mod') : () => void
+>require : any
+>'./mod' : "./mod"
+
+mod() // should be callable from here too
+>mod() : void
+>mod : () => void
+
+=== tests/cases/conformance/salsa/mod.js ===
+module.exports = function x() { }
+>module.exports = function x() { } : () => void
+>module.exports : () => void
+>module : { "tests/cases/conformance/salsa/mod": () => void; }
+>exports : () => void
+>function x() { } : () => void
+>x : () => void
+
+module.exports() // should be callable
+>module.exports() : void
+>module.exports : () => void
+>module : { "tests/cases/conformance/salsa/mod": () => void; }
+>exports : () => void
+
diff --git a/tests/baselines/reference/moduleExportPropertyAssignmentDefault.symbols b/tests/baselines/reference/moduleExportPropertyAssignmentDefault.symbols
new file mode 100644
index 0000000000000..403287f1c9e03
--- /dev/null
+++ b/tests/baselines/reference/moduleExportPropertyAssignmentDefault.symbols
@@ -0,0 +1,18 @@
+=== tests/cases/conformance/salsa/axios.js ===
+var axios = {}
+>axios : Symbol(axios, Decl(axios.js, 0, 3))
+
+module.exports = axios // both assignments should be ok
+>module.exports : Symbol("tests/cases/conformance/salsa/axios", Decl(axios.js, 0, 0))
+>module : Symbol(export=, Decl(axios.js, 0, 14))
+>exports : Symbol(export=, Decl(axios.js, 0, 14))
+>axios : Symbol(axios, Decl(axios.js, 0, 3))
+
+module.exports.default = axios
+>module.exports.default : Symbol(default)
+>module.exports : Symbol(default, Decl(axios.js, 1, 22))
+>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/axios", Decl(axios.js, 0, 0))
+>default : Symbol(default, Decl(axios.js, 1, 22))
+>axios : Symbol(axios, Decl(axios.js, 0, 3))
+
diff --git a/tests/baselines/reference/moduleExportPropertyAssignmentDefault.types b/tests/baselines/reference/moduleExportPropertyAssignmentDefault.types
new file mode 100644
index 0000000000000..91d1c65f4c8c5
--- /dev/null
+++ b/tests/baselines/reference/moduleExportPropertyAssignmentDefault.types
@@ -0,0 +1,21 @@
+=== tests/cases/conformance/salsa/axios.js ===
+var axios = {}
+>axios : { [x: string]: any; default: { [x: string]: any; }; }
+>{} : { [x: string]: any; }
+
+module.exports = axios // both assignments should be ok
+>module.exports = axios : { [x: string]: any; default: { [x: string]: any; }; }
+>module.exports : { [x: string]: any; default: { [x: string]: any; }; }
+>module : { "tests/cases/conformance/salsa/axios": { [x: string]: any; default: { [x: string]: any; }; }; }
+>exports : { [x: string]: any; default: { [x: string]: any; }; }
+>axios : { [x: string]: any; }
+
+module.exports.default = axios
+>module.exports.default = axios : { [x: string]: any; }
+>module.exports.default : { [x: string]: any; }
+>module.exports : { [x: string]: any; default: { [x: string]: any; }; }
+>module : { "tests/cases/conformance/salsa/axios": { [x: string]: any; default: { [x: string]: any; }; }; }
+>exports : { [x: string]: any; default: { [x: string]: any; }; }
+>default : { [x: string]: any; }
+>axios : { [x: string]: any; }
+
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment.symbols b/tests/baselines/reference/moduleExportWithExportPropertyAssignment.symbols
index 4398dffd7d630..d6e1bdfa96c4f 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment.symbols
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment.symbols
@@ -31,7 +31,7 @@ module.exports = function () { }
/** @param {number} a */
module.exports.f = function (a) { }
->module.exports.f : Symbol(f, Decl(mod1.js, 1, 32))
+>module.exports.f : Symbol(f)
>module.exports : Symbol(f, Decl(mod1.js, 1, 32))
>module : Symbol(module)
>exports : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment.types b/tests/baselines/reference/moduleExportWithExportPropertyAssignment.types
index 3ed45fb921fcd..c608ae0a91f9e 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment.types
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment.types
@@ -28,19 +28,19 @@ declare function require(name: string): any;
=== tests/cases/conformance/salsa/mod1.js ===
///
module.exports = function () { }
->module.exports = function () { } : typeof import("tests/cases/conformance/salsa/mod1")
->module.exports : typeof import("tests/cases/conformance/salsa/mod1")
->module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
->exports : typeof import("tests/cases/conformance/salsa/mod1")
+>module.exports = function () { } : { (): void; f: (a: number) => void; }
+>module.exports : { (): void; f: (a: number) => void; }
+>module : { "tests/cases/conformance/salsa/mod1": { (): void; f: (a: number) => void; }; }
+>exports : { (): void; f: (a: number) => void; }
>function () { } : () => void
/** @param {number} a */
module.exports.f = function (a) { }
>module.exports.f = function (a) { } : (a: number) => void
>module.exports.f : (a: number) => void
->module.exports : typeof import("tests/cases/conformance/salsa/mod1")
->module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
->exports : typeof import("tests/cases/conformance/salsa/mod1")
+>module.exports : { (): void; f: (a: number) => void; }
+>module : { "tests/cases/conformance/salsa/mod1": { (): void; f: (a: number) => void; }; }
+>exports : { (): void; f: (a: number) => void; }
>f : (a: number) => void
>function (a) { } : (a: number) => void
>a : number
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.errors.txt b/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.errors.txt
index 66cb517a25be7..4b0e72b999543 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.errors.txt
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.errors.txt
@@ -1,4 +1,5 @@
tests/cases/conformance/salsa/a.js(4,6): error TS2339: Property 'f' does not exist on type 'number'.
+tests/cases/conformance/salsa/mod1.js(3,16): error TS2339: Property 'f' does not exist on type 'number'.
==== tests/cases/conformance/salsa/a.js (1 errors) ====
@@ -12,8 +13,10 @@ tests/cases/conformance/salsa/a.js(4,6): error TS2339: Property 'f' does not exi
==== tests/cases/conformance/salsa/requires.d.ts (0 errors) ====
declare var module: { exports: any };
declare function require(name: string): any;
-==== tests/cases/conformance/salsa/mod1.js (0 errors) ====
+==== tests/cases/conformance/salsa/mod1.js (1 errors) ====
///
module.exports = 1
module.exports.f = function () { }
+ ~
+!!! error TS2339: Property 'f' does not exist on type 'number'.
\ No newline at end of file
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.symbols b/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.symbols
index e8bbbd4f8a4fb..815f4ff9512ef 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.symbols
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.symbols
@@ -30,7 +30,6 @@ module.exports = 1
>exports : Symbol(export=, Decl(mod1.js, 0, 0))
module.exports.f = function () { }
->module.exports.f : Symbol(f, Decl(mod1.js, 1, 18))
>module.exports : Symbol(f, Decl(mod1.js, 1, 18))
>module : Symbol(module)
>exports : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.types b/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.types
index ab81e2f37a2b5..3e10c04bc6909 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.types
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment2.types
@@ -31,18 +31,18 @@ declare function require(name: string): any;
=== tests/cases/conformance/salsa/mod1.js ===
///
module.exports = 1
->module.exports = 1 : typeof import("tests/cases/conformance/salsa/mod1")
->module.exports : typeof import("tests/cases/conformance/salsa/mod1")
->module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
->exports : typeof import("tests/cases/conformance/salsa/mod1")
+>module.exports = 1 : number
+>module.exports : number
+>module : { "tests/cases/conformance/salsa/mod1": number; }
+>exports : number
>1 : 1
module.exports.f = function () { }
>module.exports.f = function () { } : () => void
->module.exports.f : () => void
->module.exports : typeof import("tests/cases/conformance/salsa/mod1")
->module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
->exports : typeof import("tests/cases/conformance/salsa/mod1")
->f : () => void
+>module.exports.f : any
+>module.exports : number
+>module : { "tests/cases/conformance/salsa/mod1": number; }
+>exports : number
+>f : any
>function () { } : () => void
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment3.symbols b/tests/baselines/reference/moduleExportWithExportPropertyAssignment3.symbols
index eb752a5620d26..731137a0a84b7 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment3.symbols
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment3.symbols
@@ -41,7 +41,7 @@ declare function require(name: string): any;
=== tests/cases/conformance/salsa/mod1.js ===
///
module.exports.bothBefore = 'string'
->module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0))
+>module.exports.bothBefore : Symbol(bothBefore)
>module.exports : Symbol(bothBefore, Decl(mod1.js, 0, 0))
>module : Symbol(module)
>exports : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
@@ -62,14 +62,14 @@ module.exports = {
>bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18))
}
module.exports.bothAfter = 'string'
->module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 6, 1))
+>module.exports.bothAfter : Symbol(bothAfter)
>module.exports : Symbol(bothAfter, Decl(mod1.js, 6, 1))
>module : Symbol(module)
>exports : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
>bothAfter : Symbol(bothAfter, Decl(mod1.js, 6, 1))
module.exports.justProperty = 'string'
->module.exports.justProperty : Symbol(justProperty, Decl(mod1.js, 7, 35))
+>module.exports.justProperty : Symbol(justProperty)
>module.exports : Symbol(justProperty, Decl(mod1.js, 7, 35))
>module : Symbol(module)
>exports : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment3.types b/tests/baselines/reference/moduleExportWithExportPropertyAssignment3.types
index 1f44288644e3f..71b7dbe7089c7 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment3.types
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment3.types
@@ -50,18 +50,18 @@ declare function require(name: string): any;
///
module.exports.bothBefore = 'string'
>module.exports.bothBefore = 'string' : "string"
->module.exports.bothBefore : string
->module.exports : typeof import("tests/cases/conformance/salsa/mod1")
->module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
->exports : typeof import("tests/cases/conformance/salsa/mod1")
->bothBefore : string
+>module.exports.bothBefore : string | number
+>module.exports : { [x: string]: any; justExport: number; bothBefore: string | number; bothAfter: string | number; justProperty: string; }
+>module : { "tests/cases/conformance/salsa/mod1": { [x: string]: any; justExport: number; bothBefore: string | number; bothAfter: string | number; justProperty: string; }; }
+>exports : { [x: string]: any; justExport: number; bothBefore: string | number; bothAfter: string | number; justProperty: string; }
+>bothBefore : string | number
>'string' : "string"
module.exports = {
->module.exports = { justExport: 1, bothBefore: 2, bothAfter: 3,} : typeof import("tests/cases/conformance/salsa/mod1")
->module.exports : typeof import("tests/cases/conformance/salsa/mod1")
->module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
->exports : typeof import("tests/cases/conformance/salsa/mod1")
+>module.exports = { justExport: 1, bothBefore: 2, bothAfter: 3,} : { [x: string]: any; justExport: number; bothBefore: string | number; bothAfter: string | number; justProperty: string; }
+>module.exports : { [x: string]: any; justExport: number; bothBefore: string | number; bothAfter: string | number; justProperty: string; }
+>module : { "tests/cases/conformance/salsa/mod1": { [x: string]: any; justExport: number; bothBefore: string | number; bothAfter: string | number; justProperty: string; }; }
+>exports : { [x: string]: any; justExport: number; bothBefore: string | number; bothAfter: string | number; justProperty: string; }
>{ justExport: 1, bothBefore: 2, bothAfter: 3,} : { [x: string]: any; justExport: number; bothBefore: number; bothAfter: number; }
justExport: 1,
@@ -78,19 +78,19 @@ module.exports = {
}
module.exports.bothAfter = 'string'
>module.exports.bothAfter = 'string' : "string"
->module.exports.bothAfter : string
->module.exports : typeof import("tests/cases/conformance/salsa/mod1")
->module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
->exports : typeof import("tests/cases/conformance/salsa/mod1")
->bothAfter : string
+>module.exports.bothAfter : string | number
+>module.exports : { [x: string]: any; justExport: number; bothBefore: string | number; bothAfter: string | number; justProperty: string; }
+>module : { "tests/cases/conformance/salsa/mod1": { [x: string]: any; justExport: number; bothBefore: string | number; bothAfter: string | number; justProperty: string; }; }
+>exports : { [x: string]: any; justExport: number; bothBefore: string | number; bothAfter: string | number; justProperty: string; }
+>bothAfter : string | number
>'string' : "string"
module.exports.justProperty = 'string'
>module.exports.justProperty = 'string' : "string"
>module.exports.justProperty : string
->module.exports : typeof import("tests/cases/conformance/salsa/mod1")
->module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
->exports : typeof import("tests/cases/conformance/salsa/mod1")
+>module.exports : { [x: string]: any; justExport: number; bothBefore: string | number; bothAfter: string | number; justProperty: string; }
+>module : { "tests/cases/conformance/salsa/mod1": { [x: string]: any; justExport: number; bothBefore: string | number; bothAfter: string | number; justProperty: string; }; }
+>exports : { [x: string]: any; justExport: number; bothBefore: string | number; bothAfter: string | number; justProperty: string; }
>justProperty : string
>'string' : "string"
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.symbols b/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.symbols
index 64ae9d8dcb400..9e7f2d607d3d4 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.symbols
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.symbols
@@ -41,7 +41,7 @@ declare function require(name: string): any;
=== tests/cases/conformance/salsa/mod1.js ===
///
module.exports.bothBefore = 'string'
->module.exports.bothBefore : Symbol(A.bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0))
+>module.exports.bothBefore : Symbol(bothBefore)
>module.exports : Symbol(A.bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0))
>module : Symbol(module)
>exports : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
@@ -75,14 +75,14 @@ function A() {
>p : Symbol(A.p, Decl(mod1.js, 6, 14))
}
module.exports.bothAfter = 'string'
->module.exports.bothAfter : Symbol(A.bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1))
+>module.exports.bothAfter : Symbol(bothAfter)
>module.exports : Symbol(A.bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1))
>module : Symbol(module)
>exports : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
>bothAfter : Symbol(A.bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1))
module.exports.justProperty = 'string'
->module.exports.justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35))
+>module.exports.justProperty : Symbol(justProperty)
>module.exports : Symbol(justProperty, Decl(mod1.js, 9, 35))
>module : Symbol(module)
>exports : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.types b/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.types
index 2d0a715b6ce00..924a88d60441b 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.types
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.types
@@ -51,9 +51,9 @@ declare function require(name: string): any;
module.exports.bothBefore = 'string'
>module.exports.bothBefore = 'string' : "string"
>module.exports.bothBefore : string | number
->module.exports : typeof import("tests/cases/conformance/salsa/mod1")
->module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
->exports : typeof import("tests/cases/conformance/salsa/mod1")
+>module.exports : typeof A
+>module : { "tests/cases/conformance/salsa/mod1": typeof A; }
+>exports : typeof A
>bothBefore : string | number
>'string' : "string"
@@ -79,10 +79,10 @@ A.bothAfter = 3
>3 : 3
module.exports = A
->module.exports = A : typeof import("tests/cases/conformance/salsa/mod1")
->module.exports : typeof import("tests/cases/conformance/salsa/mod1")
->module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
->exports : typeof import("tests/cases/conformance/salsa/mod1")
+>module.exports = A : typeof A
+>module.exports : typeof A
+>module : { "tests/cases/conformance/salsa/mod1": typeof A; }
+>exports : typeof A
>A : typeof A
function A() {
@@ -98,18 +98,18 @@ function A() {
module.exports.bothAfter = 'string'
>module.exports.bothAfter = 'string' : "string"
>module.exports.bothAfter : string | number
->module.exports : typeof import("tests/cases/conformance/salsa/mod1")
->module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
->exports : typeof import("tests/cases/conformance/salsa/mod1")
+>module.exports : typeof A
+>module : { "tests/cases/conformance/salsa/mod1": typeof A; }
+>exports : typeof A
>bothAfter : string | number
>'string' : "string"
module.exports.justProperty = 'string'
>module.exports.justProperty = 'string' : "string"
>module.exports.justProperty : string
->module.exports : typeof import("tests/cases/conformance/salsa/mod1")
->module : { "tests/cases/conformance/salsa/mod1": typeof import("tests/cases/conformance/salsa/mod1"); }
->exports : typeof import("tests/cases/conformance/salsa/mod1")
+>module.exports : typeof A
+>module : { "tests/cases/conformance/salsa/mod1": typeof A; }
+>exports : typeof A
>justProperty : string
>'string' : "string"
diff --git a/tests/baselines/reference/paramTagTypeResolution.types b/tests/baselines/reference/paramTagTypeResolution.types
index f38d11421c3d3..56533fb7d65b2 100644
--- a/tests/baselines/reference/paramTagTypeResolution.types
+++ b/tests/baselines/reference/paramTagTypeResolution.types
@@ -18,10 +18,10 @@ f(1, n => { })
* @param {(t: T) => void} k
*/
module.exports = function (x, k) { return k(x) }
->module.exports = function (x, k) { return k(x) } : typeof import("tests/cases/conformance/jsdoc/first")
->module.exports : typeof import("tests/cases/conformance/jsdoc/first")
->module : { "tests/cases/conformance/jsdoc/first": typeof import("tests/cases/conformance/jsdoc/first"); }
->exports : typeof import("tests/cases/conformance/jsdoc/first")
+>module.exports = function (x, k) { return k(x) } : (x: T, k: (t: T) => void) => void
+>module.exports : (x: T, k: (t: T) => void) => void
+>module : { "tests/cases/conformance/jsdoc/first": (x: T, k: (t: T) => void) => void; }
+>exports : (x: T, k: (t: T) => void) => void
>function (x, k) { return k(x) } : (x: T, k: (t: T) => void) => void
>x : T
>k : (t: T) => void
diff --git a/tests/baselines/reference/typeFromPropertyAssignment17.types b/tests/baselines/reference/typeFromPropertyAssignment17.types
index eff1e14ebe618..448880f4c89a7 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment17.types
+++ b/tests/baselines/reference/typeFromPropertyAssignment17.types
@@ -43,10 +43,10 @@ declare var module: any;
=== tests/cases/conformance/salsa/minimatch.js ===
///
module.exports = minimatch
->module.exports = minimatch : typeof import("tests/cases/conformance/salsa/minimatch")
->module.exports : typeof import("tests/cases/conformance/salsa/minimatch")
->module : { "tests/cases/conformance/salsa/minimatch": typeof import("tests/cases/conformance/salsa/minimatch"); }
->exports : typeof import("tests/cases/conformance/salsa/minimatch")
+>module.exports = minimatch : { (): void; M: typeof M; filter: () => void; }
+>module.exports : { (): void; M: typeof M; filter: () => void; }
+>module : { "tests/cases/conformance/salsa/minimatch": { (): void; M: typeof M; filter: () => void; }; }
+>exports : { (): void; M: typeof M; filter: () => void; }
>minimatch : { (): void; M: typeof M; filter: () => void; }
minimatch.M = M
diff --git a/tests/baselines/reference/typeFromPropertyAssignment19.types b/tests/baselines/reference/typeFromPropertyAssignment19.types
index 6c27236b929cf..87c76be3099ea 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment19.types
+++ b/tests/baselines/reference/typeFromPropertyAssignment19.types
@@ -24,12 +24,12 @@ declare var module: any;
=== tests/cases/conformance/salsa/semver.js ===
///
exports = module.exports = C
->exports = module.exports = C : typeof import("tests/cases/conformance/salsa/semver")
->exports : typeof import("tests/cases/conformance/salsa/semver")
->module.exports = C : typeof import("tests/cases/conformance/salsa/semver")
->module.exports : typeof import("tests/cases/conformance/salsa/semver")
->module : { "tests/cases/conformance/salsa/semver": typeof import("tests/cases/conformance/salsa/semver"); }
->exports : typeof import("tests/cases/conformance/salsa/semver")
+>exports = module.exports = C : typeof C
+>exports : typeof C
+>module.exports = C : typeof C
+>module.exports : typeof C
+>module : { "tests/cases/conformance/salsa/semver": typeof C; }
+>exports : typeof C
>C : typeof C
C.f = n => n + 1
diff --git a/tests/baselines/reference/typedefCrossModule.types b/tests/baselines/reference/typedefCrossModule.types
index 681da8e9b4cd7..c7719e96bb40e 100644
--- a/tests/baselines/reference/typedefCrossModule.types
+++ b/tests/baselines/reference/typedefCrossModule.types
@@ -9,10 +9,10 @@ declare var module: { exports: any};
/** @typedef {{ type: "b", y: 1 }} B */
/** @typedef {A | B} Both */
module.exports = C
->module.exports = C : typeof import("tests/cases/conformance/jsdoc/mod1")
->module.exports : typeof import("tests/cases/conformance/jsdoc/mod1")
->module : { "tests/cases/conformance/jsdoc/mod1": typeof import("tests/cases/conformance/jsdoc/mod1"); }
->exports : typeof import("tests/cases/conformance/jsdoc/mod1")
+>module.exports = C : typeof C
+>module.exports : typeof C
+>module : { "tests/cases/conformance/jsdoc/mod1": typeof C; }
+>exports : typeof C
>C : typeof C
function C() {
diff --git a/tests/baselines/reference/typedefCrossModule2.types b/tests/baselines/reference/typedefCrossModule2.types
index 1a918b5a8c68d..27b5933b311db 100644
--- a/tests/baselines/reference/typedefCrossModule2.types
+++ b/tests/baselines/reference/typedefCrossModule2.types
@@ -31,16 +31,16 @@ class Foo { } // should error
exports.Bar = class { }
>exports.Bar = class { } : typeof Bar
>exports.Bar : typeof Bar
->exports : typeof import("tests/cases/conformance/jsdoc/mod1")
+>exports : { [x: string]: any; Baz: any; Bar: typeof Bar; Quid: any; } | { [x: string]: any; Quack: any; Bar: typeof Bar; Quid: any; }
>Bar : typeof Bar
>class { } : typeof Bar
/** @typedef {number} Baz */
module.exports = {
->module.exports = { Baz: class { }} : typeof import("tests/cases/conformance/jsdoc/mod1")
->module.exports : typeof import("tests/cases/conformance/jsdoc/mod1")
->module : { "tests/cases/conformance/jsdoc/mod1": typeof import("tests/cases/conformance/jsdoc/mod1"); }
->exports : typeof import("tests/cases/conformance/jsdoc/mod1")
+>module.exports = { Baz: class { }} : { [x: string]: any; Baz: any; Bar: typeof Bar; Quid: any; } | { [x: string]: any; Quack: any; Bar: typeof Bar; Quid: any; }
+>module.exports : { [x: string]: any; Baz: any; Bar: typeof Bar; Quid: any; } | { [x: string]: any; Quack: any; Bar: typeof Bar; Quid: any; }
+>module : { "tests/cases/conformance/jsdoc/mod1": { [x: string]: any; Baz: any; Bar: typeof Bar; Quid: any; } | { [x: string]: any; Quack: any; Bar: typeof Bar; Quid: any; }; }
+>exports : { [x: string]: any; Baz: any; Bar: typeof Bar; Quid: any; } | { [x: string]: any; Quack: any; Bar: typeof Bar; Quid: any; }
>{ Baz: class { }} : { [x: string]: any; Baz: typeof Baz; }
Baz: class { }
@@ -59,16 +59,16 @@ var Qux = 2;
exports.Quid = 2;
>exports.Quid = 2 : 2
>exports.Quid : any
->exports : typeof import("tests/cases/conformance/jsdoc/mod1")
+>exports : { [x: string]: any; Baz: any; Bar: typeof Bar; Quid: any; } | { [x: string]: any; Quack: any; Bar: typeof Bar; Quid: any; }
>Quid : any
>2 : 2
/** @typedef {number} Quack */
module.exports = {
->module.exports = { Quack: 2} : typeof import("tests/cases/conformance/jsdoc/mod1")
->module.exports : typeof import("tests/cases/conformance/jsdoc/mod1")
->module : { "tests/cases/conformance/jsdoc/mod1": typeof import("tests/cases/conformance/jsdoc/mod1"); }
->exports : typeof import("tests/cases/conformance/jsdoc/mod1")
+>module.exports = { Quack: 2} : { [x: string]: any; Baz: any; Bar: typeof Bar; Quid: any; } | { [x: string]: any; Quack: any; Bar: typeof Bar; Quid: any; }
+>module.exports : { [x: string]: any; Baz: any; Bar: typeof Bar; Quid: any; } | { [x: string]: any; Quack: any; Bar: typeof Bar; Quid: any; }
+>module : { "tests/cases/conformance/jsdoc/mod1": { [x: string]: any; Baz: any; Bar: typeof Bar; Quid: any; } | { [x: string]: any; Quack: any; Bar: typeof Bar; Quid: any; }; }
+>exports : { [x: string]: any; Baz: any; Bar: typeof Bar; Quid: any; } | { [x: string]: any; Quack: any; Bar: typeof Bar; Quid: any; }
>{ Quack: 2} : { [x: string]: any; Quack: number; }
Quack: 2
diff --git a/tests/baselines/reference/typedefCrossModule3.types b/tests/baselines/reference/typedefCrossModule3.types
index 39155091cf56b..3685895022056 100644
--- a/tests/baselines/reference/typedefCrossModule3.types
+++ b/tests/baselines/reference/typedefCrossModule3.types
@@ -12,10 +12,10 @@ ns.Foo = class {}
>class {} : typeof Foo
module.exports = ns;
->module.exports = ns : typeof import("tests/cases/conformance/jsdoc/mod2")
->module.exports : typeof import("tests/cases/conformance/jsdoc/mod2")
->module : { "tests/cases/conformance/jsdoc/mod2": typeof import("tests/cases/conformance/jsdoc/mod2"); }
->exports : typeof import("tests/cases/conformance/jsdoc/mod2")
+>module.exports = ns : typeof ns
+>module.exports : typeof ns
+>module : { "tests/cases/conformance/jsdoc/mod2": typeof ns; }
+>exports : typeof ns
>ns : typeof ns
diff --git a/tests/baselines/reference/typedefCrossModule4.types b/tests/baselines/reference/typedefCrossModule4.types
index c685392543a83..479e247327363 100644
--- a/tests/baselines/reference/typedefCrossModule4.types
+++ b/tests/baselines/reference/typedefCrossModule4.types
@@ -4,10 +4,10 @@ class Bar { }
>Bar : Bar
module.exports = { Foo: Bar };
->module.exports = { Foo: Bar } : typeof import("tests/cases/conformance/jsdoc/mod3")
->module.exports : typeof import("tests/cases/conformance/jsdoc/mod3")
->module : { "tests/cases/conformance/jsdoc/mod3": typeof import("tests/cases/conformance/jsdoc/mod3"); }
->exports : typeof import("tests/cases/conformance/jsdoc/mod3")
+>module.exports = { Foo: Bar } : { [x: string]: any; Foo: any; }
+>module.exports : { [x: string]: any; Foo: any; }
+>module : { "tests/cases/conformance/jsdoc/mod3": { [x: string]: any; Foo: any; }; }
+>exports : { [x: string]: any; Foo: any; }
>{ Foo: Bar } : { [x: string]: any; Foo: typeof Bar; }
>Foo : typeof Bar
>Bar : typeof Bar
From a490b37184d324e8375962b95b49f693f7fb05b5 Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Thu, 19 Jul 2018 10:06:09 -0700
Subject: [PATCH 09/16] Follow merged symbols+allow any object type
This allows exports like `module.exports = new EE` to have properties
added to them.
Still messy, but I'm going to run user tests and look for regressions.
---
src/compiler/checker.ts | 9 ++-
.../reference/moduleExportAssignment.symbols | 68 ++++++++++++++++
.../reference/moduleExportAssignment.types | 79 +++++++++++++++++++
.../reference/moduleExportAssignment2.symbols | 2 +-
...ExportWithExportPropertyAssignment.symbols | 2 +-
...xportWithExportPropertyAssignment3.symbols | 2 +-
.../salsa/moduleExportAssignment.ts | 5 ++
7 files changed, 161 insertions(+), 6 deletions(-)
create mode 100644 tests/baselines/reference/moduleExportAssignment.symbols
create mode 100644 tests/baselines/reference/moduleExportAssignment.types
diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts
index 792c85e5eb1fd..1a233f90fb7a1 100644
--- a/src/compiler/checker.ts
+++ b/src/compiler/checker.ts
@@ -4771,12 +4771,15 @@ namespace ts {
// If we don't have an explicit JSDoc type, get the type from the expression.
let type = aliased !== symbol ? getTypeOfSymbol(aliased) : getWidenedLiteralType(checkExpressionCached(expression.right));
- if (getObjectFlags(type) & ObjectFlags.Anonymous &&
+ if (type.flags & TypeFlags.Object &&
special === SpecialPropertyAssignmentKind.ModuleExports &&
symbol.escapedName === InternalSymbolName.ExportEquals) {
- const exportedType = resolveStructuredTypeMembers(type as AnonymousType);
+ const exportedType = resolveStructuredTypeMembers(type as ObjectType);
const members = createSymbolTable();
copyEntries(exportedType.members, members);
+ if (aliased !== symbol && !aliased.exports) {
+ aliased.exports = createSymbolTable();
+ }
(aliased !== symbol ? aliased : symbol).exports!.forEach((s, name) => {
if (members.has(name)) {
const exportedMember = exportedType.members.get(name)!;
@@ -5234,7 +5237,7 @@ namespace ts {
const resolvedModule = resolveExternalModuleSymbol(symbol);
if (resolvedModule !== symbol) {
- const original = symbol.exports!.get(InternalSymbolName.ExportEquals)!;
+ const original = getMergedSymbol(symbol.exports!.get(InternalSymbolName.ExportEquals)!);
// TODO: Maybe call this in resolveModuleFromTypeLiteral or whatever (the weird webpack example now works better than the alternative)
// (or boost the ability of getTypeOfSymbol [Property case] to recognise artificially augmented symbols, and then just always call getTypeOfSymbol)
let t = getWidenedTypeFromJSSpecialPropertyDeclarations(original, resolvedModule);
diff --git a/tests/baselines/reference/moduleExportAssignment.symbols b/tests/baselines/reference/moduleExportAssignment.symbols
new file mode 100644
index 0000000000000..ed3db1581a7d3
--- /dev/null
+++ b/tests/baselines/reference/moduleExportAssignment.symbols
@@ -0,0 +1,68 @@
+=== tests/cases/conformance/salsa/use.js ===
+var npmlog = require('./npmlog')
+>npmlog : Symbol(npmlog, Decl(use.js, 0, 3))
+>require : Symbol(require)
+>'./npmlog' : Symbol("tests/cases/conformance/salsa/npmlog", Decl(npmlog.js, 0, 0))
+
+npmlog.x
+>npmlog.x : Symbol(x, Decl(npmlog.js, 7, 23))
+>npmlog : Symbol(npmlog, Decl(use.js, 0, 3))
+>x : Symbol(x, Decl(npmlog.js, 7, 23))
+
+npmlog.on
+>npmlog.on : Symbol(EE.on, Decl(npmlog.js, 0, 10))
+>npmlog : Symbol(npmlog, Decl(use.js, 0, 3))
+>on : Symbol(EE.on, Decl(npmlog.js, 0, 10))
+
+=== tests/cases/conformance/salsa/npmlog.js ===
+class EE {
+>EE : Symbol(EE, Decl(npmlog.js, 0, 0))
+
+ /** @param {string} s */
+ on(s) { }
+>on : Symbol(EE.on, Decl(npmlog.js, 0, 10))
+>s : Symbol(s, Decl(npmlog.js, 2, 7))
+}
+var npmlog = module.exports = new EE()
+>npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3))
+>module.exports : Symbol("tests/cases/conformance/salsa/npmlog", Decl(npmlog.js, 0, 0))
+>module : Symbol(npmlog, Decl(npmlog.js, 4, 12))
+>exports : Symbol(npmlog, Decl(npmlog.js, 4, 12))
+>EE : Symbol(EE, Decl(npmlog.js, 0, 0))
+
+npmlog.on('hi') // both references should see EE.on
+>npmlog.on : Symbol(EE.on, Decl(npmlog.js, 0, 10))
+>npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3))
+>on : Symbol(EE.on, Decl(npmlog.js, 0, 10))
+
+module.exports.on('hi') // here too
+>module.exports.on : Symbol(EE.on, Decl(npmlog.js, 0, 10))
+>module.exports : Symbol("tests/cases/conformance/salsa/npmlog", Decl(npmlog.js, 0, 0))
+>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/npmlog", Decl(npmlog.js, 0, 0))
+>on : Symbol(EE.on, Decl(npmlog.js, 0, 10))
+
+npmlog.x = 1
+>npmlog.x : Symbol(x, Decl(npmlog.js, 7, 23))
+>npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3))
+>x : Symbol(x, Decl(npmlog.js, 7, 23))
+
+module.exports.y = 2
+>module.exports.y : Symbol(y, Decl(npmlog.js, 9, 12))
+>module.exports : Symbol(y, Decl(npmlog.js, 9, 12))
+>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/npmlog", Decl(npmlog.js, 0, 0))
+>y : Symbol(y, Decl(npmlog.js, 9, 12))
+
+npmlog.y
+>npmlog.y : Symbol(y, Decl(npmlog.js, 9, 12))
+>npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3))
+>y : Symbol(y, Decl(npmlog.js, 9, 12))
+
+module.exports.x
+>module.exports.x : Symbol(x, Decl(npmlog.js, 7, 23))
+>module.exports : Symbol("tests/cases/conformance/salsa/npmlog", Decl(npmlog.js, 0, 0))
+>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/npmlog", Decl(npmlog.js, 0, 0))
+>x : Symbol(x, Decl(npmlog.js, 7, 23))
+
diff --git a/tests/baselines/reference/moduleExportAssignment.types b/tests/baselines/reference/moduleExportAssignment.types
new file mode 100644
index 0000000000000..a1606ef7c45ef
--- /dev/null
+++ b/tests/baselines/reference/moduleExportAssignment.types
@@ -0,0 +1,79 @@
+=== tests/cases/conformance/salsa/use.js ===
+var npmlog = require('./npmlog')
+>npmlog : typeof EE
+>require('./npmlog') : typeof EE
+>require : any
+>'./npmlog' : "./npmlog"
+
+npmlog.x
+>npmlog.x : number
+>npmlog : typeof EE
+>x : number
+
+npmlog.on
+>npmlog.on : (s: string) => void
+>npmlog : typeof EE
+>on : (s: string) => void
+
+=== tests/cases/conformance/salsa/npmlog.js ===
+class EE {
+>EE : EE
+
+ /** @param {string} s */
+ on(s) { }
+>on : (s: string) => void
+>s : string
+}
+var npmlog = module.exports = new EE()
+>npmlog : typeof EE
+>module.exports = new EE() : typeof EE
+>module.exports : typeof EE
+>module : { "tests/cases/conformance/salsa/npmlog": typeof EE; }
+>exports : typeof EE
+>new EE() : EE
+>EE : typeof EE
+
+npmlog.on('hi') // both references should see EE.on
+>npmlog.on('hi') : void
+>npmlog.on : (s: string) => void
+>npmlog : typeof EE
+>on : (s: string) => void
+>'hi' : "hi"
+
+module.exports.on('hi') // here too
+>module.exports.on('hi') : void
+>module.exports.on : (s: string) => void
+>module.exports : typeof EE
+>module : { "tests/cases/conformance/salsa/npmlog": typeof EE; }
+>exports : typeof EE
+>on : (s: string) => void
+>'hi' : "hi"
+
+npmlog.x = 1
+>npmlog.x = 1 : 1
+>npmlog.x : number
+>npmlog : typeof EE
+>x : number
+>1 : 1
+
+module.exports.y = 2
+>module.exports.y = 2 : 2
+>module.exports.y : number
+>module.exports : typeof EE
+>module : { "tests/cases/conformance/salsa/npmlog": typeof EE; }
+>exports : typeof EE
+>y : number
+>2 : 2
+
+npmlog.y
+>npmlog.y : number
+>npmlog : typeof EE
+>y : number
+
+module.exports.x
+>module.exports.x : number
+>module.exports : typeof EE
+>module : { "tests/cases/conformance/salsa/npmlog": typeof EE; }
+>exports : typeof EE
+>x : number
+
diff --git a/tests/baselines/reference/moduleExportAssignment2.symbols b/tests/baselines/reference/moduleExportAssignment2.symbols
index 2c7bdc586b181..2046942a82a44 100644
--- a/tests/baselines/reference/moduleExportAssignment2.symbols
+++ b/tests/baselines/reference/moduleExportAssignment2.symbols
@@ -7,7 +7,7 @@ var npm = module.exports = function (tree) {
>tree : Symbol(tree, Decl(npm.js, 0, 37))
}
module.exports.asReadInstalled = function (tree) {
->module.exports.asReadInstalled : Symbol(asReadInstalled)
+>module.exports.asReadInstalled : Symbol(asReadInstalled, Decl(npm.js, 1, 1))
>module.exports : Symbol(asReadInstalled, Decl(npm.js, 1, 1))
>module : Symbol(module)
>exports : Symbol("tests/cases/conformance/salsa/npm", Decl(npm.js, 0, 0))
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment.symbols b/tests/baselines/reference/moduleExportWithExportPropertyAssignment.symbols
index d6e1bdfa96c4f..4398dffd7d630 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment.symbols
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment.symbols
@@ -31,7 +31,7 @@ module.exports = function () { }
/** @param {number} a */
module.exports.f = function (a) { }
->module.exports.f : Symbol(f)
+>module.exports.f : Symbol(f, Decl(mod1.js, 1, 32))
>module.exports : Symbol(f, Decl(mod1.js, 1, 32))
>module : Symbol(module)
>exports : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment3.symbols b/tests/baselines/reference/moduleExportWithExportPropertyAssignment3.symbols
index 731137a0a84b7..cbb9ec28b7b7c 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment3.symbols
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment3.symbols
@@ -69,7 +69,7 @@ module.exports.bothAfter = 'string'
>bothAfter : Symbol(bothAfter, Decl(mod1.js, 6, 1))
module.exports.justProperty = 'string'
->module.exports.justProperty : Symbol(justProperty)
+>module.exports.justProperty : Symbol(justProperty, Decl(mod1.js, 7, 35))
>module.exports : Symbol(justProperty, Decl(mod1.js, 7, 35))
>module : Symbol(module)
>exports : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
diff --git a/tests/cases/conformance/salsa/moduleExportAssignment.ts b/tests/cases/conformance/salsa/moduleExportAssignment.ts
index b558020d3abf6..b0f9b3a4258f7 100644
--- a/tests/cases/conformance/salsa/moduleExportAssignment.ts
+++ b/tests/cases/conformance/salsa/moduleExportAssignment.ts
@@ -15,3 +15,8 @@ npmlog.x = 1
module.exports.y = 2
npmlog.y
module.exports.x
+
+// @Filename: use.js
+var npmlog = require('./npmlog')
+npmlog.x
+npmlog.on
From 27dcb56b45ae1f079dcc00e3d2fe789ab45960f4 Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Thu, 19 Jul 2018 10:38:57 -0700
Subject: [PATCH 10/16] Update improved user baselines
---
tests/baselines/reference/user/assert.log | 18 ++--
tests/baselines/reference/user/npmlog.log | 102 ++--------------------
2 files changed, 16 insertions(+), 104 deletions(-)
diff --git a/tests/baselines/reference/user/assert.log b/tests/baselines/reference/user/assert.log
index 2038217a29d56..37a2c42e4d60e 100644
--- a/tests/baselines/reference/user/assert.log
+++ b/tests/baselines/reference/user/assert.log
@@ -1,14 +1,14 @@
Exit Code: 1
Standard output:
-node_modules/assert/assert.js(124,8): error TS2339: Property 'name' does not exist on type 'typeof import("/assert/node_modules/assert/assert")'.
-node_modules/assert/assert.js(125,8): error TS2339: Property 'actual' does not exist on type 'typeof import("/assert/node_modules/assert/assert")'.
-node_modules/assert/assert.js(126,8): error TS2339: Property 'expected' does not exist on type 'typeof import("/assert/node_modules/assert/assert")'.
-node_modules/assert/assert.js(127,8): error TS2339: Property 'operator' does not exist on type 'typeof import("/assert/node_modules/assert/assert")'.
-node_modules/assert/assert.js(129,10): error TS2339: Property 'message' does not exist on type 'typeof import("/assert/node_modules/assert/assert")'.
-node_modules/assert/assert.js(130,10): error TS2339: Property 'generatedMessage' does not exist on type 'typeof import("/assert/node_modules/assert/assert")'.
-node_modules/assert/assert.js(132,10): error TS2339: Property 'message' does not exist on type 'typeof import("/assert/node_modules/assert/assert")'.
-node_modules/assert/assert.js(133,10): error TS2339: Property 'generatedMessage' does not exist on type 'typeof import("/assert/node_modules/assert/assert")'.
-node_modules/assert/assert.js(154,12): error TS2339: Property 'stack' does not exist on type 'typeof import("/assert/node_modules/assert/assert")'.
+node_modules/assert/assert.js(124,8): error TS2540: Cannot assign to 'name' because it is a constant or a read-only property.
+node_modules/assert/assert.js(125,8): error TS2339: Property 'actual' does not exist on type 'typeof ok'.
+node_modules/assert/assert.js(126,8): error TS2339: Property 'expected' does not exist on type 'typeof ok'.
+node_modules/assert/assert.js(127,8): error TS2339: Property 'operator' does not exist on type 'typeof ok'.
+node_modules/assert/assert.js(129,10): error TS2339: Property 'message' does not exist on type 'typeof ok'.
+node_modules/assert/assert.js(130,10): error TS2339: Property 'generatedMessage' does not exist on type 'typeof ok'.
+node_modules/assert/assert.js(132,10): error TS2339: Property 'message' does not exist on type 'typeof ok'.
+node_modules/assert/assert.js(133,10): error TS2339: Property 'generatedMessage' does not exist on type 'typeof ok'.
+node_modules/assert/assert.js(154,12): error TS2339: Property 'stack' does not exist on type 'typeof ok'.
node_modules/assert/test.js(25,5): error TS2367: This condition will always return 'false' since the types 'string | undefined' and 'boolean' have no overlap.
node_modules/assert/test.js(39,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'?
node_modules/assert/test.js(55,5): error TS2552: Cannot find name 'test'. Did you mean 'tests'?
diff --git a/tests/baselines/reference/user/npmlog.log b/tests/baselines/reference/user/npmlog.log
index 1c698e3cbf6c5..cdd163fa0f1a1 100644
--- a/tests/baselines/reference/user/npmlog.log
+++ b/tests/baselines/reference/user/npmlog.log
@@ -1,100 +1,12 @@
Exit Code: 1
Standard output:
-node_modules/npmlog/log.js(25,5): error TS2339: Property 'useColor' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(29,5): error TS2339: Property 'enableColor' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(31,8): error TS2339: Property 'gauge' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(33,5): error TS2339: Property 'disableColor' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(35,8): error TS2339: Property 'gauge' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(39,5): error TS2339: Property 'level' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(41,5): error TS2339: Property 'gauge' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(43,25): error TS2339: Property 'useColor' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(53,5): error TS2339: Property 'tracker' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(57,5): error TS2339: Property 'progressEnabled' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(57,27): error TS2339: Property 'gauge' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(61,5): error TS2339: Property 'enableUnicode' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(63,8): error TS2339: Property 'gauge' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(63,39): error TS2339: Property 'useColor' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(66,5): error TS2339: Property 'disableUnicode' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(68,8): error TS2339: Property 'gauge' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(68,39): error TS2339: Property 'useColor' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(71,5): error TS2339: Property 'setGaugeThemeset' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(72,8): error TS2339: Property 'gauge' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(75,5): error TS2339: Property 'setGaugeTemplate' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(76,8): error TS2339: Property 'gauge' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(79,5): error TS2339: Property 'enableProgress' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(80,12): error TS2339: Property 'progressEnabled' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(81,8): error TS2339: Property 'progressEnabled' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(82,8): error TS2339: Property 'tracker' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(82,34): error TS2339: Property 'showProgress' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(83,12): error TS2339: Property '_pause' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(84,8): error TS2339: Property 'gauge' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(87,5): error TS2339: Property 'disableProgress' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(88,13): error TS2339: Property 'progressEnabled' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(89,8): error TS2339: Property 'progressEnabled' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(90,8): error TS2339: Property 'tracker' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(90,46): error TS2339: Property 'showProgress' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(91,8): error TS2339: Property 'gauge' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(122,47): error TS2339: Property 'tracker' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(122,69): error TS2339: Property 'tracker' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(125,5): error TS2339: Property 'clearProgress' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(126,13): error TS2339: Property 'progressEnabled' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(127,8): error TS2339: Property 'gauge' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(130,5): error TS2339: Property 'showProgress' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(134,18): error TS2339: Property 'record' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(134,29): error TS2339: Property 'record' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(137,20): error TS2339: Property 'disp' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(138,42): error TS2339: Property 'style' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(148,5): error TS2339: Property 'pause' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(149,8): error TS2339: Property '_paused' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(150,12): error TS2339: Property 'progressEnabled' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(150,34): error TS2339: Property 'gauge' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(153,5): error TS2339: Property 'resume' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(154,13): error TS2339: Property '_paused' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(155,8): error TS2339: Property '_paused' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(157,16): error TS2339: Property '_buffer' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(158,8): error TS2339: Property '_buffer' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(162,12): error TS2339: Property 'progressEnabled' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(162,34): error TS2339: Property 'gauge' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(165,5): error TS2339: Property '_buffer' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(168,5): error TS2339: Property 'record' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(169,5): error TS2339: Property 'maxRecordSize' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(170,5): error TS2339: Property 'log' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(217,5): error TS2339: Property 'emitLog' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(218,12): error TS2339: Property '_paused' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(219,10): error TS2339: Property '_buffer' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(222,12): error TS2339: Property 'progressEnabled' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(222,34): error TS2339: Property 'gauge' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(223,16): error TS2339: Property 'levels' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(225,16): error TS2339: Property 'levels' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(225,28): error TS2339: Property 'level' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(230,18): error TS2339: Property 'disp' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(230,46): error TS2339: Property 'disp' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(231,8): error TS2339: Property 'clearProgress' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(237,26): error TS2339: Property 'style' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(243,8): error TS2339: Property 'showProgress' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(246,5): error TS2339: Property '_format' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(250,12): error TS2339: Property 'useColor' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(262,12): error TS2339: Property 'useColor' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(268,5): error TS2339: Property 'write' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(271,21): error TS2339: Property '_format' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(274,5): error TS2339: Property 'addLevel' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(277,8): error TS2339: Property 'levels' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(278,8): error TS2339: Property 'style' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(289,8): error TS2339: Property 'disp' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(292,5): error TS2339: Property 'prefixStyle' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(293,5): error TS2339: Property 'headingStyle' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(295,5): error TS2339: Property 'style' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(296,5): error TS2339: Property 'levels' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(297,5): error TS2339: Property 'disp' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(298,5): error TS2339: Property 'addLevel' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(299,5): error TS2339: Property 'addLevel' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(300,5): error TS2339: Property 'addLevel' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(301,5): error TS2339: Property 'addLevel' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(302,5): error TS2339: Property 'addLevel' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(303,5): error TS2339: Property 'addLevel' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(304,5): error TS2339: Property 'addLevel' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(305,5): error TS2339: Property 'addLevel' does not exist on type 'EventEmitter'.
-node_modules/npmlog/log.js(306,5): error TS2339: Property 'addLevel' does not exist on type 'EventEmitter'.
+node_modules/npmlog/log.js(83,12): error TS2551: Property '_pause' does not exist on type 'typeof EventEmitter'. Did you mean 'pause'?
+node_modules/npmlog/log.js(149,8): error TS2551: Property '_paused' does not exist on type 'typeof EventEmitter'. Did you mean 'pause'?
+node_modules/npmlog/log.js(154,13): error TS2551: Property '_paused' does not exist on type 'typeof EventEmitter'. Did you mean 'pause'?
+node_modules/npmlog/log.js(155,8): error TS2551: Property '_paused' does not exist on type 'typeof EventEmitter'. Did you mean 'pause'?
+node_modules/npmlog/log.js(218,12): error TS2551: Property '_paused' does not exist on type 'typeof EventEmitter'. Did you mean 'pause'?
+node_modules/npmlog/log.js(271,16): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
+ Type 'undefined' is not assignable to type 'string'.
From 23605655758e2415e576981f73c8da4ea974e48e Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Thu, 19 Jul 2018 13:43:49 -0700
Subject: [PATCH 11/16] Fix infinite recursion when checking module.exports
---
src/compiler/checker.ts | 6 ++++++
.../reference/moduleExportAssignment4.symbols | 13 ++++++++++++
.../reference/moduleExportAssignment4.types | 21 +++++++++++++++++++
.../salsa/moduleExportAssignment4.ts | 6 ++++++
4 files changed, 46 insertions(+)
create mode 100644 tests/baselines/reference/moduleExportAssignment4.symbols
create mode 100644 tests/baselines/reference/moduleExportAssignment4.types
create mode 100644 tests/cases/conformance/salsa/moduleExportAssignment4.ts
diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts
index 1a233f90fb7a1..f063552105796 100644
--- a/src/compiler/checker.ts
+++ b/src/compiler/checker.ts
@@ -5237,6 +5237,9 @@ namespace ts {
const resolvedModule = resolveExternalModuleSymbol(symbol);
if (resolvedModule !== symbol) {
+ if (!pushTypeResolution(symbol, TypeSystemPropertyName.Type)) {
+ return errorType;
+ }
const original = getMergedSymbol(symbol.exports!.get(InternalSymbolName.ExportEquals)!);
// TODO: Maybe call this in resolveModuleFromTypeLiteral or whatever (the weird webpack example now works better than the alternative)
// (or boost the ability of getTypeOfSymbol [Property case] to recognise artificially augmented symbols, and then just always call getTypeOfSymbol)
@@ -5245,6 +5248,9 @@ namespace ts {
if (t === errorType) {
t = getTypeOfSymbol(resolvedModule);
}
+ if (!popTypeResolution()) {
+ t = reportCircularityError(symbol);
+ }
links.type = t;
return links.type;
}
diff --git a/tests/baselines/reference/moduleExportAssignment4.symbols b/tests/baselines/reference/moduleExportAssignment4.symbols
new file mode 100644
index 0000000000000..530b452c200f0
--- /dev/null
+++ b/tests/baselines/reference/moduleExportAssignment4.symbols
@@ -0,0 +1,13 @@
+=== tests/cases/conformance/salsa/async.js ===
+exports.default = { m: 1, a: 1 }
+>exports : Symbol(default, Decl(async.js, 0, 0))
+>default : Symbol(default, Decl(async.js, 0, 0))
+>m : Symbol(m, Decl(async.js, 0, 19))
+>a : Symbol(a, Decl(async.js, 0, 25))
+
+module.exports = exports['default'];
+>module.exports : Symbol("tests/cases/conformance/salsa/async", Decl(async.js, 0, 0))
+>module : Symbol(export=, Decl(async.js, 0, 32))
+>exports : Symbol(export=, Decl(async.js, 0, 32))
+>exports : Symbol("tests/cases/conformance/salsa/async", Decl(async.js, 0, 0))
+
diff --git a/tests/baselines/reference/moduleExportAssignment4.types b/tests/baselines/reference/moduleExportAssignment4.types
new file mode 100644
index 0000000000000..56e0e6463813c
--- /dev/null
+++ b/tests/baselines/reference/moduleExportAssignment4.types
@@ -0,0 +1,21 @@
+=== tests/cases/conformance/salsa/async.js ===
+exports.default = { m: 1, a: 1 }
+>exports.default = { m: 1, a: 1 } : { [x: string]: any; m: number; a: number; }
+>exports.default : any
+>exports : any
+>default : any
+>{ m: 1, a: 1 } : { [x: string]: any; m: number; a: number; }
+>m : number
+>1 : 1
+>a : number
+>1 : 1
+
+module.exports = exports['default'];
+>module.exports = exports['default'] : any
+>module.exports : any
+>module : { "tests/cases/conformance/salsa/async": any; }
+>exports : any
+>exports['default'] : any
+>exports : any
+>'default' : "default"
+
diff --git a/tests/cases/conformance/salsa/moduleExportAssignment4.ts b/tests/cases/conformance/salsa/moduleExportAssignment4.ts
new file mode 100644
index 0000000000000..979c423b6ddac
--- /dev/null
+++ b/tests/cases/conformance/salsa/moduleExportAssignment4.ts
@@ -0,0 +1,6 @@
+// @noEmit: true
+// @allowJs: true
+// @checkJs: true
+// @Filename: async.js
+exports.default = { m: 1, a: 1 }
+module.exports = exports['default'];
From 37a3a8276235bb1274c5bec51013c9f25b38c231 Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Thu, 19 Jul 2018 14:50:36 -0700
Subject: [PATCH 12/16] Fix bogus use-before-def error
getExportSymbolOfValueSymbolIfExported should always merge its returned
symbol, whether it's symbol.exportSymbol or just symbol.
---
src/compiler/checker.ts | 4 +-
.../reference/moduleExportAssignment5.symbols | 33 +++++++++++++++++
.../reference/moduleExportAssignment5.types | 37 +++++++++++++++++++
...oduleExportPropertyAssignmentDefault.types | 26 ++++++-------
...xportWithExportPropertyAssignment4.symbols | 8 ++--
...eExportWithExportPropertyAssignment4.types | 8 ++--
.../reference/typedefCrossModule3.symbols | 4 +-
.../salsa/moduleExportAssignment5.ts | 14 +++++++
8 files changed, 108 insertions(+), 26 deletions(-)
create mode 100644 tests/baselines/reference/moduleExportAssignment5.symbols
create mode 100644 tests/baselines/reference/moduleExportAssignment5.types
create mode 100644 tests/cases/conformance/salsa/moduleExportAssignment5.ts
diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts
index f063552105796..93885b329ccc2 100644
--- a/src/compiler/checker.ts
+++ b/src/compiler/checker.ts
@@ -2529,9 +2529,7 @@ namespace ts {
function getExportSymbolOfValueSymbolIfExported(symbol: Symbol): Symbol;
function getExportSymbolOfValueSymbolIfExported(symbol: Symbol | undefined): Symbol | undefined;
function getExportSymbolOfValueSymbolIfExported(symbol: Symbol | undefined): Symbol | undefined {
- return symbol && (symbol.flags & SymbolFlags.ExportValue) !== 0
- ? getMergedSymbol(symbol.exportSymbol)
- : symbol;
+ return getMergedSymbol(symbol && (symbol.flags & SymbolFlags.ExportValue) !== 0 ? symbol.exportSymbol : symbol);
}
function symbolIsValue(symbol: Symbol): boolean {
diff --git a/tests/baselines/reference/moduleExportAssignment5.symbols b/tests/baselines/reference/moduleExportAssignment5.symbols
new file mode 100644
index 0000000000000..baaedb0562d7e
--- /dev/null
+++ b/tests/baselines/reference/moduleExportAssignment5.symbols
@@ -0,0 +1,33 @@
+=== tests/cases/conformance/salsa/axios.js ===
+class Axios {
+>Axios : Symbol(Axios, Decl(axios.js, 0, 0))
+
+ constructor() {
+ }
+ m() { }
+>m : Symbol(Axios.m, Decl(axios.js, 2, 5))
+}
+var axios = new Axios();
+>axios : Symbol(axios, Decl(axios.js, 5, 3))
+>Axios : Symbol(Axios, Decl(axios.js, 0, 0))
+
+// none of the 3 references should have a use-before-def error
+axios.m()
+>axios.m : Symbol(Axios.m, Decl(axios.js, 2, 5))
+>axios : Symbol(axios, Decl(axios.js, 5, 3))
+>m : Symbol(Axios.m, Decl(axios.js, 2, 5))
+
+module.exports = axios;
+>module.exports : Symbol("tests/cases/conformance/salsa/axios", Decl(axios.js, 0, 0))
+>module : Symbol(export=, Decl(axios.js, 7, 9))
+>exports : Symbol(export=, Decl(axios.js, 7, 9))
+>axios : Symbol(axios, Decl(axios.js, 5, 3))
+
+module.exports.default = axios;
+>module.exports.default : Symbol(default, Decl(axios.js, 8, 23))
+>module.exports : Symbol(default, Decl(axios.js, 8, 23))
+>module : Symbol(module)
+>exports : Symbol("tests/cases/conformance/salsa/axios", Decl(axios.js, 0, 0))
+>default : Symbol(default, Decl(axios.js, 8, 23))
+>axios : Symbol(axios, Decl(axios.js, 5, 3))
+
diff --git a/tests/baselines/reference/moduleExportAssignment5.types b/tests/baselines/reference/moduleExportAssignment5.types
new file mode 100644
index 0000000000000..646cedfb4c4d8
--- /dev/null
+++ b/tests/baselines/reference/moduleExportAssignment5.types
@@ -0,0 +1,37 @@
+=== tests/cases/conformance/salsa/axios.js ===
+class Axios {
+>Axios : Axios
+
+ constructor() {
+ }
+ m() { }
+>m : () => void
+}
+var axios = new Axios();
+>axios : Axios
+>new Axios() : Axios
+>Axios : typeof Axios
+
+// none of the 3 references should have a use-before-def error
+axios.m()
+>axios.m() : void
+>axios.m : () => void
+>axios : Axios
+>m : () => void
+
+module.exports = axios;
+>module.exports = axios : typeof Axios
+>module.exports : typeof Axios
+>module : { "tests/cases/conformance/salsa/axios": typeof Axios; }
+>exports : typeof Axios
+>axios : Axios
+
+module.exports.default = axios;
+>module.exports.default = axios : Axios
+>module.exports.default : Axios
+>module.exports : typeof Axios
+>module : { "tests/cases/conformance/salsa/axios": typeof Axios; }
+>exports : typeof Axios
+>default : Axios
+>axios : Axios
+
diff --git a/tests/baselines/reference/moduleExportPropertyAssignmentDefault.types b/tests/baselines/reference/moduleExportPropertyAssignmentDefault.types
index 91d1c65f4c8c5..a65961e4daa1d 100644
--- a/tests/baselines/reference/moduleExportPropertyAssignmentDefault.types
+++ b/tests/baselines/reference/moduleExportPropertyAssignmentDefault.types
@@ -1,21 +1,21 @@
=== tests/cases/conformance/salsa/axios.js ===
var axios = {}
->axios : { [x: string]: any; default: { [x: string]: any; }; }
+>axios : { [x: string]: any; default: { [x: string]: any; default: any; }; }
>{} : { [x: string]: any; }
module.exports = axios // both assignments should be ok
->module.exports = axios : { [x: string]: any; default: { [x: string]: any; }; }
->module.exports : { [x: string]: any; default: { [x: string]: any; }; }
->module : { "tests/cases/conformance/salsa/axios": { [x: string]: any; default: { [x: string]: any; }; }; }
->exports : { [x: string]: any; default: { [x: string]: any; }; }
->axios : { [x: string]: any; }
+>module.exports = axios : { [x: string]: any; default: any; }
+>module.exports : { [x: string]: any; default: any; }
+>module : { "tests/cases/conformance/salsa/axios": { [x: string]: any; default: any; }; }
+>exports : { [x: string]: any; default: any; }
+>axios : { [x: string]: any; default: { [x: string]: any; default: any; }; }
module.exports.default = axios
->module.exports.default = axios : { [x: string]: any; }
->module.exports.default : { [x: string]: any; }
->module.exports : { [x: string]: any; default: { [x: string]: any; }; }
->module : { "tests/cases/conformance/salsa/axios": { [x: string]: any; default: { [x: string]: any; }; }; }
->exports : { [x: string]: any; default: { [x: string]: any; }; }
->default : { [x: string]: any; }
->axios : { [x: string]: any; }
+>module.exports.default = axios : { [x: string]: any; default: { [x: string]: any; default: any; }; }
+>module.exports.default : { [x: string]: any; default: any; }
+>module.exports : { [x: string]: any; default: any; }
+>module : { "tests/cases/conformance/salsa/axios": { [x: string]: any; default: any; }; }
+>exports : { [x: string]: any; default: any; }
+>default : { [x: string]: any; default: any; }
+>axios : { [x: string]: any; default: { [x: string]: any; default: any; }; }
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.symbols b/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.symbols
index 9e7f2d607d3d4..89399657de72b 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.symbols
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.symbols
@@ -53,14 +53,14 @@ A.justExport = 4
>justExport : Symbol(A.justExport, Decl(mod1.js, 1, 36))
A.bothBefore = 2
->A.bothBefore : Symbol(A.bothBefore, Decl(mod1.js, 2, 16))
+>A.bothBefore : Symbol(A.bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0))
>A : Symbol(A, Decl(mod1.js, 5, 18))
->bothBefore : Symbol(A.bothBefore, Decl(mod1.js, 2, 16))
+>bothBefore : Symbol(A.bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0))
A.bothAfter = 3
->A.bothAfter : Symbol(A.bothAfter, Decl(mod1.js, 3, 16))
+>A.bothAfter : Symbol(A.bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1))
>A : Symbol(A, Decl(mod1.js, 5, 18))
->bothAfter : Symbol(A.bothAfter, Decl(mod1.js, 3, 16))
+>bothAfter : Symbol(A.bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1))
module.exports = A
>module.exports : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.types b/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.types
index 924a88d60441b..8c55a664fc2e9 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.types
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.types
@@ -66,16 +66,16 @@ A.justExport = 4
A.bothBefore = 2
>A.bothBefore = 2 : 2
->A.bothBefore : number
+>A.bothBefore : string | number
>A : typeof A
->bothBefore : number
+>bothBefore : string | number
>2 : 2
A.bothAfter = 3
>A.bothAfter = 3 : 3
->A.bothAfter : number
+>A.bothAfter : string | number
>A : typeof A
->bothAfter : number
+>bothAfter : string | number
>3 : 3
module.exports = A
diff --git a/tests/baselines/reference/typedefCrossModule3.symbols b/tests/baselines/reference/typedefCrossModule3.symbols
index 829e243dbac98..e4085c79bf15d 100644
--- a/tests/baselines/reference/typedefCrossModule3.symbols
+++ b/tests/baselines/reference/typedefCrossModule3.symbols
@@ -4,9 +4,9 @@ const ns = {};
>ns : Symbol(ns, Decl(mod2.js, 1, 5), Decl(mod2.js, 1, 14))
ns.Foo = class {}
->ns.Foo : Symbol(ns.Foo, Decl(mod2.js, 1, 14))
+>ns.Foo : Symbol(Foo, Decl(mod2.js, 1, 14), Decl(mod2.js, 0, 4))
>ns : Symbol(ns, Decl(mod2.js, 1, 5), Decl(mod2.js, 1, 14))
->Foo : Symbol(ns.Foo, Decl(mod2.js, 1, 14))
+>Foo : Symbol(Foo, Decl(mod2.js, 1, 14), Decl(mod2.js, 0, 4))
module.exports = ns;
>module.exports : Symbol("tests/cases/conformance/jsdoc/mod2", Decl(mod2.js, 0, 0))
diff --git a/tests/cases/conformance/salsa/moduleExportAssignment5.ts b/tests/cases/conformance/salsa/moduleExportAssignment5.ts
new file mode 100644
index 0000000000000..798e83d6db359
--- /dev/null
+++ b/tests/cases/conformance/salsa/moduleExportAssignment5.ts
@@ -0,0 +1,14 @@
+// @noEmit: true
+// @allowJs: true
+// @checkJs: true
+// @Filename: axios.js
+class Axios {
+ constructor() {
+ }
+ m() { }
+}
+var axios = new Axios();
+// none of the 3 references should have a use-before-def error
+axios.m()
+module.exports = axios;
+module.exports.default = axios;
From 2714c10de1b49e82c0aeb8ff1e63332dfff783ea Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Thu, 19 Jul 2018 15:34:46 -0700
Subject: [PATCH 13/16] Update user test baselines
---
.../user/chrome-devtools-frontend.log | 153 +-
.../reference/user/create-react-app.log | 1 -
tests/baselines/reference/user/debug.log | 23 +-
tests/baselines/reference/user/lodash.log | 4 +-
tests/baselines/reference/user/npm.log | 1707 ++++++++---------
5 files changed, 918 insertions(+), 970 deletions(-)
diff --git a/tests/baselines/reference/user/chrome-devtools-frontend.log b/tests/baselines/reference/user/chrome-devtools-frontend.log
index 4343200c0499a..7b78dfd4e0e46 100644
--- a/tests/baselines/reference/user/chrome-devtools-frontend.log
+++ b/tests/baselines/reference/user/chrome-devtools-frontend.log
@@ -761,39 +761,6 @@ node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighth
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20039,15): error TS2339: Property 'runLighthouseForConnection' does not exist on type 'Window'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20046,8): error TS2339: Property 'getDefaultCategories' does not exist on type 'Window'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20050,8): error TS2339: Property 'listenForStatus' does not exist on type 'Window'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20178,8): error TS2339: Property 'AssertionError' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20179,6): error TS2540: Cannot assign to 'name' because it is a constant or a read-only property.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20180,6): error TS2339: Property 'actual' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20181,6): error TS2339: Property 'expected' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20182,6): error TS2339: Property 'operator' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20184,6): error TS2339: Property 'message' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20185,6): error TS2339: Property 'generatedMessage' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20187,6): error TS2339: Property 'message' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20188,6): error TS2339: Property 'generatedMessage' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20209,6): error TS2339: Property 'stack' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20215,22): error TS2339: Property 'AssertionError' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20250,18): error TS2339: Property 'AssertionError' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20260,8): error TS2339: Property 'fail' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20270,47): error TS2339: Property 'ok' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20272,8): error TS2339: Property 'ok' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20278,8): error TS2339: Property 'equal' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20279,62): error TS2339: Property 'equal' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20285,8): error TS2339: Property 'notEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20287,42): error TS2339: Property 'notEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20294,8): error TS2339: Property 'deepEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20296,49): error TS2339: Property 'deepEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20300,8): error TS2339: Property 'deepStrictEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20302,55): error TS2339: Property 'deepStrictEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20421,8): error TS2339: Property 'notDeepEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20423,52): error TS2339: Property 'notDeepEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20427,8): error TS2339: Property 'notDeepStrictEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20438,8): error TS2339: Property 'strictEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20440,43): error TS2339: Property 'strictEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20447,8): error TS2339: Property 'notStrictEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20449,43): error TS2339: Property 'notStrictEqual' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20528,8): error TS2339: Property 'throws' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20533,8): error TS2339: Property 'doesNotThrow' does not exist on type '(value: any, message: any) => void'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20537,8): error TS2339: Property 'ifError' does not exist on type '(value: any, message: any) => void'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20785,6): error TS2339: Property 'callback' does not exist on type 'Zlib'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20896,6): error TS2339: Property 'onerror' does not exist on type 'Zlib'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20987,8): error TS2350: Only a void function can be called with the 'new' keyword.
@@ -1798,11 +1765,7 @@ node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighth
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(51981,33): error TS2304: Cannot find name 'WebInspector'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(51987,1): error TS2304: Cannot find name 'WebInspector'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(52034,11): error TS2304: Cannot find name 'WebInspector'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(52066,10): error TS2339: Property 'children' does not exist on type 'never'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(52070,23): error TS2339: Property 'children' does not exist on type 'never'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(52074,23): error TS2339: Property 'children' does not exist on type 'never'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(52076,18): error TS2304: Cannot find name 'WebInspector'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(52076,72): error TS2339: Property 'totalTime' does not exist on type 'never'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(52097,8): error TS2304: Cannot find name 'WebInspector'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(52105,31): error TS2304: Cannot find name 'WebInspector'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(52106,32): error TS2304: Cannot find name 'WebInspector'.
@@ -2677,7 +2640,6 @@ node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighth
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(58187,1): error TS2304: Cannot find name 'WebInspector'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(58231,13): error TS2304: Cannot find name 'WebInspector'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(58278,16): error TS2304: Cannot find name 'WebInspector'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(58296,43): error TS2339: Property 'peekLast' does not exist on type 'any[]'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(58309,20): error TS2304: Cannot find name 'WebInspector'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(58322,34): error TS2304: Cannot find name 'WebInspector'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(58343,17): error TS2304: Cannot find name 'WebInspector'.
@@ -2702,7 +2664,6 @@ node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighth
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(58426,88): error TS2304: Cannot find name 'WebInspector'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(58434,17): error TS2304: Cannot find name 'WebInspector'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(58451,4): error TS2304: Cannot find name 'WebInspector'.
-node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(58462,33): error TS2339: Property 'mergeOrdered' does not exist on type 'any[]'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(58462,60): error TS2304: Cannot find name 'WebInspector'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(58476,18): error TS2304: Cannot find name 'WebInspector'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(58491,25): error TS2339: Property 'peekLast' does not exist on type 'any[]'.
@@ -3386,8 +3347,6 @@ node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(2858,32): error
node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(2858,49): error TS2339: Property 'right' does not exist on type 'never'.
node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(3034,25): error TS2339: Property 'xRel' does not exist on type 'Pos'.
node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(4840,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(5634,9): error TS2322: Type 'BranchChunk' is not assignable to type '{ [x: string]: any; chunkSize: () => any; removeInner: typeof removeInner; collapse: (lines: any) => void; insertInner: (at: any, lines: any, height: any) => void; maybeSpill: () => void; iterN: (at: any, n: any, op: any) => boolean; }'.
- Property 'chunkSize' is missing in type 'BranchChunk'.
node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(5675,35): error TS2339: Property 'line' does not exist on type 'LineWidget'.
node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(5675,61): error TS2339: Property 'line' does not exist on type 'LineWidget'.
node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(5693,57): error TS2339: Property 'line' does not exist on type 'LineWidget'.
@@ -3446,8 +3405,6 @@ node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(7827,32): error
node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(7827,41): error TS2339: Property 'textRendering' does not exist on type 'CSSStyleDeclaration'.
node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(7828,15): error TS2339: Property 'lineDiv' does not exist on type 'Display'.
node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(7895,25): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
-node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(8259,62): error TS2339: Property 'state' does not exist on type 'any[] | Token'.
- Property 'state' does not exist on type 'any[]'.
node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(8658,17): error TS2339: Property 'outside' does not exist on type 'Pos'.
node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(8659,54): error TS2339: Property 'hitSide' does not exist on type 'Pos'.
node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(8680,19): error TS2339: Property 'div' does not exist on type 'ContentEditableInput'.
@@ -3770,7 +3727,7 @@ node_modules/chrome-devtools-frontend/front_end/common/ModuleExtensionInterfaces
node_modules/chrome-devtools-frontend/front_end/common/ModuleExtensionInterfaces.js(27,15): error TS2339: Property 'runtime' does not exist on type 'Window'.
node_modules/chrome-devtools-frontend/front_end/common/ModuleExtensionInterfaces.js(39,2): error TS1131: Property or signature expected.
node_modules/chrome-devtools-frontend/front_end/common/ModuleExtensionInterfaces.js(40,17): error TS2300: Duplicate identifier 'Options'.
-node_modules/chrome-devtools-frontend/front_end/common/ModuleExtensionInterfaces.js(40,17): error TS2339: Property 'Options' does not exist on type '{ (): void; prototype: { [x: string]: any; }; renderPromise(object: any, options?: any): Promise; }'.
+node_modules/chrome-devtools-frontend/front_end/common/ModuleExtensionInterfaces.js(40,17): error TS2339: Property 'Options' does not exist on type '{ (): void; prototype: { [x: string]: any; render(object: any, options: any): Promise; }; renderPromise(object: any, options?: any): Promise; }'.
node_modules/chrome-devtools-frontend/front_end/common/ModuleExtensionInterfaces.js(63,15): error TS2339: Property 'runtime' does not exist on type 'Window'.
node_modules/chrome-devtools-frontend/front_end/common/ModuleExtensionInterfaces.js(81,15): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
node_modules/chrome-devtools-frontend/front_end/common/ModuleExtensionInterfaces.js(105,15): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
@@ -3783,10 +3740,12 @@ node_modules/chrome-devtools-frontend/front_end/common/Object.js(119,8): error T
node_modules/chrome-devtools-frontend/front_end/common/Object.js(122,76): error TS2694: Namespace 'Common' has no exported member 'Event'.
node_modules/chrome-devtools-frontend/front_end/common/Object.js(124,15): error TS2339: Property '_listenerCallbackTuple' does not exist on type 'typeof Object'.
node_modules/chrome-devtools-frontend/front_end/common/Object.js(132,129): error TS2694: Namespace 'Common' has no exported member 'Event'.
-node_modules/chrome-devtools-frontend/front_end/common/Object.js(134,20): error TS2339: Property 'EventDescriptor' does not exist on type '{ (): void; removeEventListeners(eventList: any[]): void; prototype: { [x: string]: any; }; }'.
+node_modules/chrome-devtools-frontend/front_end/common/Object.js(134,20): error TS2339: Property 'EventDescriptor' does not exist on type '{ (): void; removeEventListeners(eventList: any[]): void; prototype: { [x: string]: any; addEventListener(eventType: symbol, listener: (arg0: any) => any, thisObject?: any): any; once(eventType: symbol): Promise<...>; removeEventListener(eventType: symbol, listener: (arg0: any) => any, thisObject?: any): void; hasEv...'.
node_modules/chrome-devtools-frontend/front_end/common/Object.js(137,39): error TS2694: Namespace 'Common.EventTarget' has no exported member 'EventDescriptor'.
+node_modules/chrome-devtools-frontend/front_end/common/Object.js(151,31): error TS2694: Namespace 'Common' has no exported member 'Event'.
node_modules/chrome-devtools-frontend/front_end/common/Object.js(153,35): error TS2694: Namespace 'Common.EventTarget' has no exported member 'EventDescriptor'.
node_modules/chrome-devtools-frontend/front_end/common/Object.js(159,15): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
+node_modules/chrome-devtools-frontend/front_end/common/Object.js(165,31): error TS2694: Namespace 'Common' has no exported member 'Event'.
node_modules/chrome-devtools-frontend/front_end/common/Object.js(172,15): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
node_modules/chrome-devtools-frontend/front_end/common/OutputStream.js(13,15): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
node_modules/chrome-devtools-frontend/front_end/common/ParsedURL.js(122,26): error TS2339: Property '_urlRegexInstance' does not exist on type 'typeof ParsedURL'.
@@ -4601,10 +4560,10 @@ node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(190,48
node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(191,11): error TS2403: Subsequent variable declarations must have the same type. Variable 'entry' must be of type '[CSSStyleSheetHeader, any[]]', but here has type 'CoverageInfo'.
node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(192,11): error TS2345: Argument of type 'CSSStyleSheetHeader' is not assignable to parameter of type '{ [x: string]: any; contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise; requestContent(): Promise; searchInContent(query: string, caseSensitive: boolean, isRegex: boolean): Promise<...>; }'.
Property '_cssModel' does not exist on type '{ [x: string]: any; contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise; requestContent(): Promise; searchInContent(query: string, caseSensitive: boolean, isRegex: boolean): Promise<...>; }'.
+node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(197,5): error TS2322: Type '[CSSStyleSheetHeader, any[]][]' is not assignable to type 'CoverageInfo[]'.
node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(197,5): error TS2322: Type '[CSSStyleSheetHeader, any[]][]' is not assignable to type 'CoverageInfo[]'.
Type '[CSSStyleSheetHeader, any[]]' is not assignable to type 'CoverageInfo'.
Property '_contentProvider' is missing in type '[CSSStyleSheetHeader, any[]]'.
-node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(197,5): error TS2322: Type '[CSSStyleSheetHeader, any[]][]' is not assignable to type 'CoverageInfo[]'.
node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(201,31): error TS2694: Namespace 'Coverage' has no exported member 'RangeUseCount'.
node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(202,32): error TS2694: Namespace 'Coverage' has no exported member 'CoverageSegment'.
node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(210,23): error TS2339: Property 'peekLast' does not exist on type 'any[]'.
@@ -4711,8 +4670,8 @@ node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(474,27): e
node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(591,44): error TS2345: Argument of type 'NODE_TYPE' is not assignable to parameter of type 'DataGridNode'.
node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(595,25): error TS2339: Property 'data' does not exist on type 'NODE_TYPE'.
node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(622,5): error TS2322: Type 'DataGridNode[]' is not assignable to type 'NODE_TYPE[]'.
- Type 'DataGridNode' is not assignable to type 'NODE_TYPE'.
node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(622,5): error TS2322: Type 'DataGridNode[]' is not assignable to type 'NODE_TYPE[]'.
+ Type 'DataGridNode' is not assignable to type 'NODE_TYPE'.
node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(641,56): error TS2339: Property 'offsetWidth' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(648,37): error TS2339: Property 'offsetWidth' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(649,41): error TS2339: Property 'rows' does not exist on type 'Element'.
@@ -4894,10 +4853,10 @@ node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(2008,1): e
node_modules/chrome-devtools-frontend/front_end/data_grid/ShowMoreDataGridNode.js(109,14): error TS2339: Property 'style' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/data_grid/SortableDataGrid.js(9,1): error TS8022: JSDoc '@extends' is not attached to a class.
node_modules/chrome-devtools-frontend/front_end/data_grid/SortableDataGrid.js(11,40): error TS2694: Namespace 'DataGrid.DataGrid' has no exported member 'ColumnDescriptor'.
-node_modules/chrome-devtools-frontend/front_end/data_grid/SortableDataGrid.js(19,5): error TS2322: Type '(a: SortableDataGridNode, b: SortableDataGridNode) => number' is not assignable to type '(arg0: NODE_TYPE, arg1: NODE_TYPE) => number'.
node_modules/chrome-devtools-frontend/front_end/data_grid/SortableDataGrid.js(19,5): error TS2322: Type '(a: SortableDataGridNode, b: SortableDataGridNode) => number' is not assignable to type '(arg0: NODE_TYPE, arg1: NODE_TYPE) => number'.
Types of parameters 'a' and 'arg0' are incompatible.
Type 'NODE_TYPE' is not assignable to type 'SortableDataGridNode'.
+node_modules/chrome-devtools-frontend/front_end/data_grid/SortableDataGrid.js(19,5): error TS2322: Type '(a: SortableDataGridNode, b: SortableDataGridNode) => number' is not assignable to type '(arg0: NODE_TYPE, arg1: NODE_TYPE) => number'.
node_modules/chrome-devtools-frontend/front_end/data_grid/SortableDataGrid.js(20,80): error TS2345: Argument of type 'SortableDataGridNode' is not assignable to parameter of type 'NODE_TYPE'.
node_modules/chrome-devtools-frontend/front_end/data_grid/SortableDataGrid.js(82,56): error TS2694: Namespace 'DataGrid.DataGrid' has no exported member 'ColumnDescriptor'.
node_modules/chrome-devtools-frontend/front_end/data_grid/SortableDataGrid.js(131,20): error TS2352: Type 'NODE_TYPE' cannot be converted to type 'SortableDataGridNode'.
@@ -4932,10 +4891,10 @@ node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(25
node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(257,47): error TS2339: Property 'offsetHeight' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(272,1): error TS8022: JSDoc '@extends' is not attached to a class.
node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(320,22): error TS2352: Type 'NODE_TYPE' cannot be converted to type 'ViewportDataGridNode'.
-node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(334,9): error TS2322: Type 'NODE_TYPE[][]' is not assignable to type 'ViewportDataGridNode[][]'.
node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(334,9): error TS2322: Type 'NODE_TYPE[][]' is not assignable to type 'ViewportDataGridNode[][]'.
Type 'NODE_TYPE[]' is not assignable to type 'ViewportDataGridNode[]'.
Type 'NODE_TYPE' is not assignable to type 'ViewportDataGridNode'.
+node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(334,9): error TS2322: Type 'NODE_TYPE[][]' is not assignable to type 'ViewportDataGridNode[][]'.
node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(363,15): error TS2339: Property 'parent' does not exist on type 'NODE_TYPE'.
node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(372,11): error TS2339: Property 'remove' does not exist on type 'NODE_TYPE'.
node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(373,11): error TS2339: Property 'parent' does not exist on type 'NODE_TYPE'.
@@ -5366,10 +5325,10 @@ node_modules/chrome-devtools-frontend/front_end/elements/ComputedStyleModel.js(3
node_modules/chrome-devtools-frontend/front_end/elements/ComputedStyleModel.js(65,22): error TS2694: Namespace 'Common' has no exported member 'Event'.
node_modules/chrome-devtools-frontend/front_end/elements/ComputedStyleModel.js(73,22): error TS2694: Namespace 'Common' has no exported member 'Event'.
node_modules/chrome-devtools-frontend/front_end/elements/ComputedStyleModel.js(84,22): error TS2694: Namespace 'Common' has no exported member 'Event'.
+node_modules/chrome-devtools-frontend/front_end/elements/ComputedStyleModel.js(122,5): error TS2322: Type 'Promise