diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts
index 61f31d7390754..0f5533e2e9bba 100644
--- a/src/compiler/checker.ts
+++ b/src/compiler/checker.ts
@@ -22436,30 +22436,23 @@ namespace ts {
const isInJS = isInJSFile(node);
if (isFunctionLike(container) &&
(!isInParameterInitializerBeforeContainingFunction(node) || getThisParameter(container))) {
+ let thisType = getThisTypeOfDeclaration(container) || isInJS && getTypeForThisExpressionFromJSDoc(container);
// Note: a parameter initializer should refer to class-this unless function-this is explicitly annotated.
// If this is a function in a JS file, it might be a class method.
- const className = getClassNameFromPrototypeMethod(container);
- if (isInJS && className) {
- const classSymbol = checkExpression(className).symbol;
- if (classSymbol && classSymbol.members && (classSymbol.flags & SymbolFlags.Function)) {
- const classType = (getDeclaredTypeOfSymbol(classSymbol) as InterfaceType).thisType;
- if (classType) {
- return getFlowTypeOfReference(node, classType);
+ if (!thisType) {
+ const className = getClassNameFromPrototypeMethod(container);
+ if (isInJS && className) {
+ const classSymbol = checkExpression(className).symbol;
+ if (classSymbol && classSymbol.members && (classSymbol.flags & SymbolFlags.Function)) {
+ thisType = (getDeclaredTypeOfSymbol(classSymbol) as InterfaceType).thisType;
}
}
- }
- // Check if it's a constructor definition, can be either a variable decl or function decl
- // i.e.
- // * /** @constructor */ function [name]() { ... }
- // * /** @constructor */ var x = function() { ... }
- else if (isInJS &&
- (container.kind === SyntaxKind.FunctionExpression || container.kind === SyntaxKind.FunctionDeclaration) &&
- getJSDocClassTag(container)) {
- const classType = (getDeclaredTypeOfSymbol(getMergedSymbol(container.symbol)) as InterfaceType).thisType!;
- return getFlowTypeOfReference(node, classType);
+ else if (isJSConstructor(container)) {
+ thisType = (getDeclaredTypeOfSymbol(getMergedSymbol(container.symbol)) as InterfaceType).thisType;
+ }
+ thisType ||= getContextualThisParameterType(container);
}
- const thisType = getThisTypeOfDeclaration(container) || getContextualThisParameterType(container);
if (thisType) {
return getFlowTypeOfReference(node, thisType);
}
@@ -22471,12 +22464,6 @@ namespace ts {
return getFlowTypeOfReference(node, type);
}
- if (isInJS) {
- const type = getTypeForThisExpressionFromJSDoc(container);
- if (type && type !== errorType) {
- return getFlowTypeOfReference(node, type);
- }
- }
if (isSourceFile(container)) {
// look up in the source file's locals or exports
if (container.commonJsModuleIndicator) {
@@ -28570,7 +28557,7 @@ namespace ts {
expr.expression.kind === SyntaxKind.ThisKeyword) {
// Look for if this is the constructor for the class that `symbol` is a property of.
const ctor = getContainingFunction(expr);
- if (!(ctor && ctor.kind === SyntaxKind.Constructor)) {
+ if (!(ctor && (ctor.kind === SyntaxKind.Constructor || isJSConstructor(ctor)))) {
return true;
}
if (symbol.valueDeclaration) {
diff --git a/src/services/codefixes/fixImplicitThis.ts b/src/services/codefixes/fixImplicitThis.ts
index bfff6fe21f10a..91758428c8b14 100644
--- a/src/services/codefixes/fixImplicitThis.ts
+++ b/src/services/codefixes/fixImplicitThis.ts
@@ -52,10 +52,5 @@ namespace ts.codefix {
return [Diagnostics.Convert_function_declaration_0_to_arrow_function, name!.text];
}
}
- // No outer 'this', add a @class tag if in a JS constructor function
- else if (isSourceFileJS(sourceFile) && isPropertyAccessExpression(token.parent) && isAssignmentExpression(token.parent.parent)) {
- addJSDocTags(changes, sourceFile, fn, [factory.createJSDocClassTag(/*tagName*/ undefined)]);
- return Diagnostics.Add_class_tag;
- }
}
}
diff --git a/tests/baselines/reference/assignmentToVoidZero2.errors.txt b/tests/baselines/reference/assignmentToVoidZero2.errors.txt
index b9da759c092cc..b6e30bda5c93c 100644
--- a/tests/baselines/reference/assignmentToVoidZero2.errors.txt
+++ b/tests/baselines/reference/assignmentToVoidZero2.errors.txt
@@ -1,11 +1,12 @@
tests/cases/conformance/salsa/assignmentToVoidZero2.js(2,9): error TS2339: Property 'k' does not exist on type 'typeof import("tests/cases/conformance/salsa/assignmentToVoidZero2")'.
tests/cases/conformance/salsa/assignmentToVoidZero2.js(5,3): error TS2339: Property 'y' does not exist on type 'typeof o'.
tests/cases/conformance/salsa/assignmentToVoidZero2.js(6,9): error TS2339: Property 'y' does not exist on type 'typeof o'.
+tests/cases/conformance/salsa/assignmentToVoidZero2.js(10,10): error TS2339: Property 'q' does not exist on type 'C'.
tests/cases/conformance/salsa/assignmentToVoidZero2.js(13,9): error TS2339: Property 'q' does not exist on type 'C'.
tests/cases/conformance/salsa/importer.js(1,13): error TS2305: Module '"./assignmentToVoidZero2"' has no exported member 'k'.
-==== tests/cases/conformance/salsa/assignmentToVoidZero2.js (4 errors) ====
+==== tests/cases/conformance/salsa/assignmentToVoidZero2.js (5 errors) ====
exports.j = 1;
exports.k = void 0;
~
@@ -22,6 +23,8 @@ tests/cases/conformance/salsa/importer.js(1,13): error TS2305: Module '"./assign
function C() {
this.p = 1
this.q = void 0
+ ~
+!!! error TS2339: Property 'q' does not exist on type 'C'.
}
var c = new C()
c.p + c.q
diff --git a/tests/baselines/reference/assignmentToVoidZero2.symbols b/tests/baselines/reference/assignmentToVoidZero2.symbols
index b5a93872fa8e3..cbb5982023493 100644
--- a/tests/baselines/reference/assignmentToVoidZero2.symbols
+++ b/tests/baselines/reference/assignmentToVoidZero2.symbols
@@ -28,9 +28,12 @@ function C() {
>C : Symbol(C, Decl(assignmentToVoidZero2.js, 5, 9))
this.p = 1
+>this.p : Symbol(C.p, Decl(assignmentToVoidZero2.js, 7, 14))
+>this : Symbol(C, Decl(assignmentToVoidZero2.js, 5, 9))
>p : Symbol(C.p, Decl(assignmentToVoidZero2.js, 7, 14))
this.q = void 0
+>this : Symbol(C, Decl(assignmentToVoidZero2.js, 5, 9))
}
var c = new C()
>c : Symbol(c, Decl(assignmentToVoidZero2.js, 11, 3))
diff --git a/tests/baselines/reference/assignmentToVoidZero2.types b/tests/baselines/reference/assignmentToVoidZero2.types
index 0b24811f9579d..e67f0ce830204 100644
--- a/tests/baselines/reference/assignmentToVoidZero2.types
+++ b/tests/baselines/reference/assignmentToVoidZero2.types
@@ -48,14 +48,14 @@ function C() {
this.p = 1
>this.p = 1 : 1
>this.p : any
->this : any
+>this : this
>p : any
>1 : 1
this.q = void 0
>this.q = void 0 : undefined
>this.q : any
->this : any
+>this : this
>q : any
>void 0 : undefined
>0 : 0
diff --git a/tests/baselines/reference/callbackCrossModule.symbols b/tests/baselines/reference/callbackCrossModule.symbols
index 7c094d4f93689..9de5c8ffbf394 100644
--- a/tests/baselines/reference/callbackCrossModule.symbols
+++ b/tests/baselines/reference/callbackCrossModule.symbols
@@ -13,6 +13,8 @@ function C() {
>C : Symbol(C, Decl(mod1.js, 4, 18))
this.p = 1
+>this.p : Symbol(C.p, Decl(mod1.js, 5, 14))
+>this : Symbol(C, Decl(mod1.js, 4, 18))
>p : Symbol(C.p, Decl(mod1.js, 5, 14))
}
diff --git a/tests/baselines/reference/callbackCrossModule.types b/tests/baselines/reference/callbackCrossModule.types
index 27e28e7ae09fb..5138fca3471cf 100644
--- a/tests/baselines/reference/callbackCrossModule.types
+++ b/tests/baselines/reference/callbackCrossModule.types
@@ -16,7 +16,7 @@ function C() {
this.p = 1
>this.p = 1 : 1
>this.p : any
->this : any
+>this : this
>p : any
>1 : 1
}
diff --git a/tests/baselines/reference/chainedPrototypeAssignment.symbols b/tests/baselines/reference/chainedPrototypeAssignment.symbols
index a37ce9f01dbec..64211c83d0206 100644
--- a/tests/baselines/reference/chainedPrototypeAssignment.symbols
+++ b/tests/baselines/reference/chainedPrototypeAssignment.symbols
@@ -42,6 +42,8 @@ var A = function A() {
>A : Symbol(A, Decl(mod.js, 1, 7))
this.a = 1
+>this.a : Symbol(A.a, Decl(mod.js, 1, 22))
+>this : Symbol(A, Decl(mod.js, 1, 7))
>a : Symbol(A.a, Decl(mod.js, 1, 22))
}
var B = function B() {
@@ -49,6 +51,8 @@ var B = function B() {
>B : Symbol(B, Decl(mod.js, 4, 7))
this.b = 2
+>this.b : Symbol(B.b, Decl(mod.js, 4, 22))
+>this : Symbol(B, Decl(mod.js, 4, 7))
>b : Symbol(B.b, Decl(mod.js, 4, 22))
}
exports.A = A
diff --git a/tests/baselines/reference/chainedPrototypeAssignment.types b/tests/baselines/reference/chainedPrototypeAssignment.types
index 0e86f9e404996..d3754807da6ae 100644
--- a/tests/baselines/reference/chainedPrototypeAssignment.types
+++ b/tests/baselines/reference/chainedPrototypeAssignment.types
@@ -52,7 +52,7 @@ var A = function A() {
this.a = 1
>this.a = 1 : 1
>this.a : any
->this : any
+>this : this
>a : any
>1 : 1
}
@@ -64,7 +64,7 @@ var B = function B() {
this.b = 2
>this.b = 2 : 2
>this.b : any
->this : any
+>this : this
>b : any
>2 : 2
}
diff --git a/tests/baselines/reference/classCanExtendConstructorFunction.symbols b/tests/baselines/reference/classCanExtendConstructorFunction.symbols
index c1c8be9272546..1fa2b59748667 100644
--- a/tests/baselines/reference/classCanExtendConstructorFunction.symbols
+++ b/tests/baselines/reference/classCanExtendConstructorFunction.symbols
@@ -193,6 +193,8 @@ function Soup(flavour) {
>flavour : Symbol(flavour, Decl(generic.js, 4, 14))
this.flavour = flavour
+>this.flavour : Symbol(Soup.flavour, Decl(generic.js, 4, 24))
+>this : Symbol(Soup, Decl(generic.js, 0, 0))
>flavour : Symbol(Soup.flavour, Decl(generic.js, 4, 24))
>flavour : Symbol(flavour, Decl(generic.js, 4, 14))
}
diff --git a/tests/baselines/reference/classCanExtendConstructorFunction.types b/tests/baselines/reference/classCanExtendConstructorFunction.types
index f667ce4b15097..a060d27e54d44 100644
--- a/tests/baselines/reference/classCanExtendConstructorFunction.types
+++ b/tests/baselines/reference/classCanExtendConstructorFunction.types
@@ -238,7 +238,7 @@ function Soup(flavour) {
this.flavour = flavour
>this.flavour = flavour : T
>this.flavour : any
->this : any
+>this : this
>flavour : any
>flavour : T
}
diff --git a/tests/baselines/reference/commonjsAccessExports.symbols b/tests/baselines/reference/commonjsAccessExports.symbols
index e98817b6f9e0f..eda1d943dc322 100644
--- a/tests/baselines/reference/commonjsAccessExports.symbols
+++ b/tests/baselines/reference/commonjsAccessExports.symbols
@@ -18,6 +18,8 @@ exports.x;
>Cls : Symbol(Cls, Decl(a.js, 4, 1))
this.x = 0;
+>this.x : Symbol(Cls.x, Decl(a.js, 6, 30))
+>this : Symbol(Cls, Decl(a.js, 6, 17))
>x : Symbol(Cls.x, Decl(a.js, 6, 30))
}
}
diff --git a/tests/baselines/reference/commonjsAccessExports.types b/tests/baselines/reference/commonjsAccessExports.types
index c5578993fe3e5..d33258547892f 100644
--- a/tests/baselines/reference/commonjsAccessExports.types
+++ b/tests/baselines/reference/commonjsAccessExports.types
@@ -24,7 +24,7 @@ exports.x;
this.x = 0;
>this.x = 0 : 0
>this.x : any
->this : any
+>this : this
>x : any
>0 : 0
}
diff --git a/tests/baselines/reference/constructorFunctionMergeWithClass.symbols b/tests/baselines/reference/constructorFunctionMergeWithClass.symbols
index ecc45e94054ff..8e2c84568ea2e 100644
--- a/tests/baselines/reference/constructorFunctionMergeWithClass.symbols
+++ b/tests/baselines/reference/constructorFunctionMergeWithClass.symbols
@@ -3,6 +3,8 @@ var SomeClass = function () {
>SomeClass : Symbol(SomeClass, Decl(file1.js, 0, 3), Decl(file2.js, 0, 0), Decl(file2.js, 0, 19))
this.otherProp = 0;
+>this.otherProp : Symbol(SomeClass.otherProp, Decl(file1.js, 0, 29))
+>this : Symbol(SomeClass, Decl(file1.js, 0, 15))
>otherProp : Symbol(SomeClass.otherProp, Decl(file1.js, 0, 29))
};
diff --git a/tests/baselines/reference/constructorFunctionMergeWithClass.types b/tests/baselines/reference/constructorFunctionMergeWithClass.types
index 7bed55aacce9d..7be3ff9ddbe70 100644
--- a/tests/baselines/reference/constructorFunctionMergeWithClass.types
+++ b/tests/baselines/reference/constructorFunctionMergeWithClass.types
@@ -6,7 +6,7 @@ var SomeClass = function () {
this.otherProp = 0;
>this.otherProp = 0 : 0
>this.otherProp : any
->this : any
+>this : this
>otherProp : any
>0 : 0
diff --git a/tests/baselines/reference/constructorFunctions.symbols b/tests/baselines/reference/constructorFunctions.symbols
index 590d4b9b8db2b..f31c593680146 100644
--- a/tests/baselines/reference/constructorFunctions.symbols
+++ b/tests/baselines/reference/constructorFunctions.symbols
@@ -3,10 +3,13 @@ function C1() {
>C1 : Symbol(C1, Decl(index.js, 0, 0))
if (!(this instanceof C1)) return new C1();
+>this : Symbol(C1, Decl(index.js, 0, 0))
>C1 : Symbol(C1, Decl(index.js, 0, 0))
>C1 : Symbol(C1, Decl(index.js, 0, 0))
this.x = 1;
+>this.x : Symbol(C1.x, Decl(index.js, 1, 47))
+>this : Symbol(C1, Decl(index.js, 0, 0))
>x : Symbol(C1.x, Decl(index.js, 1, 47))
}
@@ -22,10 +25,13 @@ var C2 = function () {
>C2 : Symbol(C2, Decl(index.js, 8, 3))
if (!(this instanceof C2)) return new C2();
+>this : Symbol(C2, Decl(index.js, 8, 8))
>C2 : Symbol(C2, Decl(index.js, 8, 3))
>C2 : Symbol(C2, Decl(index.js, 8, 3))
this.x = 1;
+>this.x : Symbol(C2.x, Decl(index.js, 9, 47))
+>this : Symbol(C2, Decl(index.js, 8, 8))
>x : Symbol(C2.x, Decl(index.js, 9, 47))
};
diff --git a/tests/baselines/reference/constructorFunctions.types b/tests/baselines/reference/constructorFunctions.types
index 84ad439394dfa..cde305f3b0bd3 100644
--- a/tests/baselines/reference/constructorFunctions.types
+++ b/tests/baselines/reference/constructorFunctions.types
@@ -6,7 +6,7 @@ function C1() {
>!(this instanceof C1) : boolean
>(this instanceof C1) : boolean
>this instanceof C1 : boolean
->this : any
+>this : this
>C1 : typeof C1
>new C1() : C1
>C1 : typeof C1
@@ -14,7 +14,7 @@ function C1() {
this.x = 1;
>this.x = 1 : 1
>this.x : any
->this : any
+>this : this
>x : any
>1 : 1
}
@@ -37,7 +37,7 @@ var C2 = function () {
>!(this instanceof C2) : boolean
>(this instanceof C2) : boolean
>this instanceof C2 : boolean
->this : any
+>this : this
>C2 : typeof C2
>new C2() : C2
>C2 : typeof C2
@@ -45,7 +45,7 @@ var C2 = function () {
this.x = 1;
>this.x = 1 : 1
>this.x : any
->this : any
+>this : this
>x : any
>1 : 1
diff --git a/tests/baselines/reference/constructorFunctions2.symbols b/tests/baselines/reference/constructorFunctions2.symbols
index 033a428e6e593..d0b5b991cce73 100644
--- a/tests/baselines/reference/constructorFunctions2.symbols
+++ b/tests/baselines/reference/constructorFunctions2.symbols
@@ -21,6 +21,8 @@ const a = new A().id;
const B = function() { this.id = 1; }
>B : Symbol(B, Decl(index.js, 3, 5))
+>this.id : Symbol(B.id, Decl(index.js, 3, 22))
+>this : Symbol(B, Decl(index.js, 3, 9))
>id : Symbol(B.id, Decl(index.js, 3, 22))
B.prototype.m = function() { this.x = 2; }
@@ -49,6 +51,8 @@ b.x;
=== tests/cases/conformance/salsa/other.js ===
function A() { this.id = 1; }
>A : Symbol(A, Decl(other.js, 0, 0))
+>this.id : Symbol(A.id, Decl(other.js, 0, 14))
+>this : Symbol(A, Decl(other.js, 0, 0))
>id : Symbol(A.id, Decl(other.js, 0, 14))
module.exports = A;
diff --git a/tests/baselines/reference/constructorFunctions2.types b/tests/baselines/reference/constructorFunctions2.types
index 2542ec7b5ecdc..0f5933e04f4be 100644
--- a/tests/baselines/reference/constructorFunctions2.types
+++ b/tests/baselines/reference/constructorFunctions2.types
@@ -26,7 +26,7 @@ const B = function() { this.id = 1; }
>function() { this.id = 1; } : typeof B
>this.id = 1 : 1
>this.id : any
->this : any
+>this : this
>id : any
>1 : 1
@@ -64,7 +64,7 @@ function A() { this.id = 1; }
>A : typeof A
>this.id = 1 : 1
>this.id : any
->this : any
+>this : this
>id : any
>1 : 1
diff --git a/tests/baselines/reference/constructorFunctions3.symbols b/tests/baselines/reference/constructorFunctions3.symbols
index 385ae3d1be2f0..4ac15758547af 100644
--- a/tests/baselines/reference/constructorFunctions3.symbols
+++ b/tests/baselines/reference/constructorFunctions3.symbols
@@ -3,6 +3,8 @@ function Instance() {
>Instance : Symbol(Instance, Decl(a.js, 0, 0))
this.i = 'simple'
+>this.i : Symbol(Instance.i, Decl(a.js, 0, 21))
+>this : Symbol(Instance, Decl(a.js, 0, 0))
>i : Symbol(Instance.i, Decl(a.js, 0, 21))
}
var i = new Instance();
@@ -19,6 +21,8 @@ function StaticToo() {
>StaticToo : Symbol(StaticToo, Decl(a.js, 5, 2), Decl(a.js, 9, 1))
this.i = 'more complex'
+>this.i : Symbol(StaticToo.i, Decl(a.js, 7, 22))
+>this : Symbol(StaticToo, Decl(a.js, 5, 2), Decl(a.js, 9, 1))
>i : Symbol(StaticToo.i, Decl(a.js, 7, 22))
}
StaticToo.property = 'yep'
@@ -41,10 +45,14 @@ function A () {
>A : Symbol(A, Decl(a.js, 13, 10), Decl(a.js, 24, 1))
this.x = 1
+>this.x : Symbol(A.x, Decl(a.js, 16, 15))
+>this : Symbol(A, Decl(a.js, 13, 10), Decl(a.js, 24, 1))
>x : Symbol(A.x, Decl(a.js, 16, 15))
/** @type {1} */
this.second = 1
+>this.second : Symbol(A.second, Decl(a.js, 17, 14))
+>this : Symbol(A, Decl(a.js, 13, 10), Decl(a.js, 24, 1))
>second : Symbol(A.second, Decl(a.js, 17, 14))
}
/** @param {number} n */
diff --git a/tests/baselines/reference/constructorFunctions3.types b/tests/baselines/reference/constructorFunctions3.types
index d15681c1c864a..16283876416b3 100644
--- a/tests/baselines/reference/constructorFunctions3.types
+++ b/tests/baselines/reference/constructorFunctions3.types
@@ -5,7 +5,7 @@ function Instance() {
this.i = 'simple'
>this.i = 'simple' : "simple"
>this.i : any
->this : any
+>this : this
>i : any
>'simple' : "simple"
}
@@ -26,7 +26,7 @@ function StaticToo() {
this.i = 'more complex'
>this.i = 'more complex' : "more complex"
>this.i : any
->this : any
+>this : this
>i : any
>'more complex' : "more complex"
}
@@ -55,16 +55,16 @@ function A () {
this.x = 1
>this.x = 1 : 1
>this.x : any
->this : any
+>this : this
>x : any
>1 : 1
/** @type {1} */
this.second = 1
>this.second = 1 : 1
->this.second : any
->this : any
->second : any
+>this.second : 1
+>this : this
+>second : 1
>1 : 1
}
/** @param {number} n */
diff --git a/tests/baselines/reference/constructorFunctionsStrict.symbols b/tests/baselines/reference/constructorFunctionsStrict.symbols
index 74727d8088ae2..529770e2628d4 100644
--- a/tests/baselines/reference/constructorFunctionsStrict.symbols
+++ b/tests/baselines/reference/constructorFunctionsStrict.symbols
@@ -5,6 +5,8 @@ function C(x) {
>x : Symbol(x, Decl(a.js, 1, 11))
this.x = x
+>this.x : Symbol(C.x, Decl(a.js, 1, 15))
+>this : Symbol(C, Decl(a.js, 0, 0))
>x : Symbol(C.x, Decl(a.js, 1, 15))
>x : Symbol(x, Decl(a.js, 1, 11))
}
@@ -41,6 +43,7 @@ function A(x) {
>x : Symbol(x, Decl(a.js, 12, 11))
if (!(this instanceof A)) {
+>this : Symbol(A, Decl(a.js, 9, 15))
>A : Symbol(A, Decl(a.js, 9, 15))
return new A(x)
@@ -48,6 +51,8 @@ function A(x) {
>x : Symbol(x, Decl(a.js, 12, 11))
}
this.x = x
+>this.x : Symbol(A.x, Decl(a.js, 15, 5))
+>this : Symbol(A, Decl(a.js, 9, 15))
>x : Symbol(A.x, Decl(a.js, 15, 5))
>x : Symbol(x, Decl(a.js, 12, 11))
}
diff --git a/tests/baselines/reference/constructorFunctionsStrict.types b/tests/baselines/reference/constructorFunctionsStrict.types
index a92024920b55d..2a4cf843fe1e6 100644
--- a/tests/baselines/reference/constructorFunctionsStrict.types
+++ b/tests/baselines/reference/constructorFunctionsStrict.types
@@ -7,7 +7,7 @@ function C(x) {
this.x = x
>this.x = x : number
>this.x : any
->this : any
+>this : this
>x : any
>x : number
}
@@ -56,7 +56,7 @@ function A(x) {
>!(this instanceof A) : boolean
>(this instanceof A) : boolean
>this instanceof A : boolean
->this : any
+>this : this
>A : typeof A
return new A(x)
@@ -67,7 +67,7 @@ function A(x) {
this.x = x
>this.x = x : number
>this.x : any
->this : any
+>this : this
>x : any
>x : number
}
diff --git a/tests/baselines/reference/constructorTagWithThisTag.symbols b/tests/baselines/reference/constructorTagWithThisTag.symbols
new file mode 100644
index 0000000000000..309e9514a5617
--- /dev/null
+++ b/tests/baselines/reference/constructorTagWithThisTag.symbols
@@ -0,0 +1,18 @@
+=== tests/cases/conformance/jsdoc/classthisboth.js ===
+/**
+ * @class
+ * @this {{ e: number, m: number }}
+ * this-tag should win, both 'e' and 'm' should be defined.
+ */
+function C() {
+>C : Symbol(C, Decl(classthisboth.js, 0, 0))
+
+ this.e = this.m + 1
+>this.e : Symbol(e, Decl(classthisboth.js, 2, 11))
+>this : Symbol(__type, Decl(classthisboth.js, 2, 10))
+>e : Symbol(C.e, Decl(classthisboth.js, 5, 14))
+>this.m : Symbol(m, Decl(classthisboth.js, 2, 22))
+>this : Symbol(__type, Decl(classthisboth.js, 2, 10))
+>m : Symbol(m, Decl(classthisboth.js, 2, 22))
+}
+
diff --git a/tests/baselines/reference/constructorTagWithThisTag.types b/tests/baselines/reference/constructorTagWithThisTag.types
new file mode 100644
index 0000000000000..7b7c2c5407246
--- /dev/null
+++ b/tests/baselines/reference/constructorTagWithThisTag.types
@@ -0,0 +1,21 @@
+=== tests/cases/conformance/jsdoc/classthisboth.js ===
+/**
+ * @class
+ * @this {{ e: number, m: number }}
+ * this-tag should win, both 'e' and 'm' should be defined.
+ */
+function C() {
+>C : typeof C
+
+ this.e = this.m + 1
+>this.e = this.m + 1 : number
+>this.e : number
+>this : { e: number; m: number; }
+>e : number
+>this.m + 1 : number
+>this.m : number
+>this : { e: number; m: number; }
+>m : number
+>1 : 1
+}
+
diff --git a/tests/baselines/reference/expandoFunctionContextualTypesJs.symbols b/tests/baselines/reference/expandoFunctionContextualTypesJs.symbols
index bf0b71f566492..bf0ef14f438b2 100644
--- a/tests/baselines/reference/expandoFunctionContextualTypesJs.symbols
+++ b/tests/baselines/reference/expandoFunctionContextualTypesJs.symbols
@@ -58,11 +58,14 @@ function foo() {
* @type {MyComponentProps}
*/
this.props = { color: "red" };
+>this.props : Symbol(foo.props, Decl(input.js, 35, 16))
+>this : Symbol(foo, Decl(input.js, 33, 28))
>props : Symbol(foo.props, Decl(input.js, 35, 16))
>color : Symbol(color, Decl(input.js, 39, 18))
expectLiteral(this);
>expectLiteral : Symbol(expectLiteral, Decl(input.js, 27, 27))
+>this : Symbol(foo, Decl(input.js, 33, 28))
}
/**
diff --git a/tests/baselines/reference/expandoFunctionContextualTypesJs.types b/tests/baselines/reference/expandoFunctionContextualTypesJs.types
index 1a9a12b8595fe..5c314a28cbaf1 100644
--- a/tests/baselines/reference/expandoFunctionContextualTypesJs.types
+++ b/tests/baselines/reference/expandoFunctionContextualTypesJs.types
@@ -70,9 +70,9 @@ function foo() {
*/
this.props = { color: "red" };
>this.props = { color: "red" } : { color: "red"; }
->this.props : any
->this : any
->props : any
+>this.props : { color: "red" | "blue"; }
+>this : this
+>props : { color: "red" | "blue"; }
>{ color: "red" } : { color: "red"; }
>color : "red"
>"red" : "red"
@@ -80,7 +80,7 @@ function foo() {
expectLiteral(this);
>expectLiteral(this) : void
>expectLiteral : (p: { props: { color: "red" | "blue"; }; }) => void
->this : any
+>this : this
}
/**
diff --git a/tests/baselines/reference/exportNestedNamespaces.symbols b/tests/baselines/reference/exportNestedNamespaces.symbols
index 10f1600a2df7b..9afe4840f3414 100644
--- a/tests/baselines/reference/exportNestedNamespaces.symbols
+++ b/tests/baselines/reference/exportNestedNamespaces.symbols
@@ -12,7 +12,8 @@ exports.n.K = function () {
>K : Symbol(n.K, Decl(mod.js, 0, 15))
this.x = 10;
->this : Symbol(n, Decl(mod.js, 0, 0), Decl(mod.js, 1, 8))
+>this.x : Symbol(K.x, Decl(mod.js, 1, 27))
+>this : Symbol(K, Decl(mod.js, 1, 13))
>x : Symbol(K.x, Decl(mod.js, 1, 27))
}
exports.Classic = class {
diff --git a/tests/baselines/reference/exportNestedNamespaces.types b/tests/baselines/reference/exportNestedNamespaces.types
index aae9e30a535ca..28cb0a5fad3dc 100644
--- a/tests/baselines/reference/exportNestedNamespaces.types
+++ b/tests/baselines/reference/exportNestedNamespaces.types
@@ -18,7 +18,7 @@ exports.n.K = function () {
this.x = 10;
>this.x = 10 : 10
>this.x : any
->this : typeof n
+>this : this
>x : any
>10 : 10
}
diff --git a/tests/baselines/reference/functionExpressionNames.symbols b/tests/baselines/reference/functionExpressionNames.symbols
index ba97fd82f5292..1675f159134b3 100644
--- a/tests/baselines/reference/functionExpressionNames.symbols
+++ b/tests/baselines/reference/functionExpressionNames.symbols
@@ -5,6 +5,8 @@ exports.E = function() {
>E : Symbol(E, Decl(b.js, 0, 0))
this.e = 'exported'
+>this.e : Symbol(E.e, Decl(b.js, 0, 24))
+>this : Symbol(E, Decl(b.js, 0, 11))
>e : Symbol(E.e, Decl(b.js, 0, 24))
}
var e = new exports.E();
@@ -20,7 +22,8 @@ var o = {
>C : Symbol(C, Decl(b.js, 5, 9))
this.c = 'nested object'
->this : Symbol(o, Decl(b.js, 5, 7))
+>this.c : Symbol(C.c, Decl(b.js, 6, 20))
+>this : Symbol(C, Decl(b.js, 6, 6))
>c : Symbol(C.c, Decl(b.js, 6, 20))
}
}
@@ -34,6 +37,8 @@ var V = function () {
>V : Symbol(V, Decl(b.js, 12, 3))
this.v = 'simple'
+>this.v : Symbol(V.v, Decl(b.js, 12, 21))
+>this : Symbol(V, Decl(b.js, 12, 7))
>v : Symbol(V.v, Decl(b.js, 12, 21))
}
var v = new V();
@@ -47,6 +52,8 @@ A = function () {
>A : Symbol(A, Decl(b.js, 17, 3))
this.a = 'assignment'
+>this.a : Symbol(A.a, Decl(b.js, 18, 17))
+>this : Symbol(A, Decl(b.js, 18, 3))
>a : Symbol(A.a, Decl(b.js, 18, 17))
}
var a = new A();
@@ -58,6 +65,8 @@ const {
>B : Symbol(B, Decl(b.js, 23, 7))
this.b = 'binding pattern'
+>this.b : Symbol(B.b, Decl(b.js, 24, 20))
+>this : Symbol(B, Decl(b.js, 24, 7))
>b : Symbol(B.b, Decl(b.js, 24, 20))
}
} = { B: undefined };
diff --git a/tests/baselines/reference/functionExpressionNames.types b/tests/baselines/reference/functionExpressionNames.types
index c3e09b4ba466f..50c45ed46d30d 100644
--- a/tests/baselines/reference/functionExpressionNames.types
+++ b/tests/baselines/reference/functionExpressionNames.types
@@ -9,7 +9,7 @@ exports.E = function() {
this.e = 'exported'
>this.e = 'exported' : "exported"
>this.e : any
->this : any
+>this : this
>e : any
>'exported' : "exported"
}
@@ -31,7 +31,7 @@ var o = {
this.c = 'nested object'
>this.c = 'nested object' : "nested object"
>this.c : any
->this : { C: typeof C; }
+>this : this
>c : any
>'nested object' : "nested object"
}
@@ -50,7 +50,7 @@ var V = function () {
this.v = 'simple'
>this.v = 'simple' : "simple"
>this.v : any
->this : any
+>this : this
>v : any
>'simple' : "simple"
}
@@ -70,7 +70,7 @@ A = function () {
this.a = 'assignment'
>this.a = 'assignment' : "assignment"
>this.a : any
->this : any
+>this : this
>a : any
>'assignment' : "assignment"
}
@@ -87,7 +87,7 @@ const {
this.b = 'binding pattern'
>this.b = 'binding pattern' : "binding pattern"
>this.b : any
->this : any
+>this : this
>b : any
>'binding pattern' : "binding pattern"
}
diff --git a/tests/baselines/reference/inferringClassMembersFromAssignments2.symbols b/tests/baselines/reference/inferringClassMembersFromAssignments2.symbols
index 457dc9bea027f..89be524d4cd08 100644
--- a/tests/baselines/reference/inferringClassMembersFromAssignments2.symbols
+++ b/tests/baselines/reference/inferringClassMembersFromAssignments2.symbols
@@ -14,6 +14,8 @@ function OOOrder() {
>OOOrder : Symbol(OOOrder, Decl(a.js, 2, 1))
this.x = 1
+>this.x : Symbol(OOOrder.x, Decl(a.js, 3, 20))
+>this : Symbol(OOOrder, Decl(a.js, 2, 1))
>x : Symbol(OOOrder.x, Decl(a.js, 3, 20))
}
diff --git a/tests/baselines/reference/inferringClassMembersFromAssignments2.types b/tests/baselines/reference/inferringClassMembersFromAssignments2.types
index 39c00bc918136..c3c9067a5d3f2 100644
--- a/tests/baselines/reference/inferringClassMembersFromAssignments2.types
+++ b/tests/baselines/reference/inferringClassMembersFromAssignments2.types
@@ -21,7 +21,7 @@ function OOOrder() {
this.x = 1
>this.x = 1 : 1
>this.x : any
->this : any
+>this : this
>x : any
>1 : 1
}
diff --git a/tests/baselines/reference/jsDeclarationsExportAssignedConstructorFunctionWithSub.errors.txt b/tests/baselines/reference/jsDeclarationsExportAssignedConstructorFunctionWithSub.errors.txt
index b0aca99dcabc1..44efa54d013cb 100644
--- a/tests/baselines/reference/jsDeclarationsExportAssignedConstructorFunctionWithSub.errors.txt
+++ b/tests/baselines/reference/jsDeclarationsExportAssignedConstructorFunctionWithSub.errors.txt
@@ -1,9 +1,7 @@
tests/cases/conformance/jsdoc/declarations/jsDeclarationsExportAssignedConstructorFunctionWithSub.js(4,1): error TS9005: Declaration emit for this file requires using private name 'exports'. An explicit type annotation may unblock declaration emit.
-tests/cases/conformance/jsdoc/declarations/jsDeclarationsExportAssignedConstructorFunctionWithSub.js(5,10): error TS2339: Property 't' does not exist on type '{ "\"tests/cases/conformance/jsdoc/declarations/jsDeclarationsExportAssignedConstructorFunctionWithSub\"": typeof exports; }'.
-tests/cases/conformance/jsdoc/declarations/jsDeclarationsExportAssignedConstructorFunctionWithSub.js(8,10): error TS2339: Property 'instance' does not exist on type 'typeof exports'.
-==== tests/cases/conformance/jsdoc/declarations/jsDeclarationsExportAssignedConstructorFunctionWithSub.js (3 errors) ====
+==== tests/cases/conformance/jsdoc/declarations/jsDeclarationsExportAssignedConstructorFunctionWithSub.js (1 errors) ====
/**
* @param {number} p
*/
@@ -11,13 +9,9 @@ tests/cases/conformance/jsdoc/declarations/jsDeclarationsExportAssignedConstruct
~~~~~~
!!! error TS9005: Declaration emit for this file requires using private name 'exports'. An explicit type annotation may unblock declaration emit.
this.t = 12 + p;
- ~
-!!! error TS2339: Property 't' does not exist on type '{ "\"tests/cases/conformance/jsdoc/declarations/jsDeclarationsExportAssignedConstructorFunctionWithSub\"": typeof exports; }'.
}
module.exports.Sub = function() {
this.instance = new module.exports(10);
- ~~~~~~~~
-!!! error TS2339: Property 'instance' does not exist on type 'typeof exports'.
}
module.exports.Sub.prototype = { }
\ No newline at end of file
diff --git a/tests/baselines/reference/jsDeclarationsExportAssignedConstructorFunctionWithSub.symbols b/tests/baselines/reference/jsDeclarationsExportAssignedConstructorFunctionWithSub.symbols
index 9f570d90194b1..44f5388809448 100644
--- a/tests/baselines/reference/jsDeclarationsExportAssignedConstructorFunctionWithSub.symbols
+++ b/tests/baselines/reference/jsDeclarationsExportAssignedConstructorFunctionWithSub.symbols
@@ -9,7 +9,8 @@ module.exports = function (p) {
>p : Symbol(p, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 3, 27))
this.t = 12 + p;
->this : Symbol(module, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 0, 0), Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 7, 23))
+>this.t : Symbol(exports.t, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 3, 31))
+>this : Symbol(exports, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 3, 16))
>t : Symbol(exports.t, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 3, 31))
>p : Symbol(p, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 3, 27))
}
@@ -21,7 +22,8 @@ module.exports.Sub = function() {
>Sub : Symbol(Sub, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 5, 1), Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 9, 15))
this.instance = new module.exports(10);
->this : Symbol(exports, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 3, 16))
+>this.instance : Symbol(Sub.instance, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 6, 33))
+>this : Symbol(Sub, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 6, 20))
>instance : Symbol(Sub.instance, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 6, 33))
>module.exports : Symbol("tests/cases/conformance/jsdoc/declarations/jsDeclarationsExportAssignedConstructorFunctionWithSub", Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 0, 0))
>module : Symbol(module, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 0, 0), Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 7, 23))
diff --git a/tests/baselines/reference/jsDeclarationsExportAssignedConstructorFunctionWithSub.types b/tests/baselines/reference/jsDeclarationsExportAssignedConstructorFunctionWithSub.types
index d40012a7ccb21..7a738df3bb026 100644
--- a/tests/baselines/reference/jsDeclarationsExportAssignedConstructorFunctionWithSub.types
+++ b/tests/baselines/reference/jsDeclarationsExportAssignedConstructorFunctionWithSub.types
@@ -13,7 +13,7 @@ module.exports = function (p) {
this.t = 12 + p;
>this.t = 12 + p : number
>this.t : any
->this : { "\"tests/cases/conformance/jsdoc/declarations/jsDeclarationsExportAssignedConstructorFunctionWithSub\"": typeof exports; }
+>this : this
>t : any
>12 + p : number
>12 : 12
@@ -31,7 +31,7 @@ module.exports.Sub = function() {
this.instance = new module.exports(10);
>this.instance = new module.exports(10) : exports
>this.instance : any
->this : typeof exports
+>this : this
>instance : any
>new module.exports(10) : exports
>module.exports : typeof exports
diff --git a/tests/baselines/reference/jsDeclarationsFunctionClassesCjsExportAssignment.symbols b/tests/baselines/reference/jsDeclarationsFunctionClassesCjsExportAssignment.symbols
index a8e34ede3cfc1..d667f9d0cc2cd 100644
--- a/tests/baselines/reference/jsDeclarationsFunctionClassesCjsExportAssignment.symbols
+++ b/tests/baselines/reference/jsDeclarationsFunctionClassesCjsExportAssignment.symbols
@@ -7,6 +7,8 @@ function Timer(timeout) {
>timeout : Symbol(timeout, Decl(timer.js, 3, 15))
this.timeout = timeout;
+>this.timeout : Symbol(Timer.timeout, Decl(timer.js, 3, 25))
+>this : Symbol(Timer, Decl(timer.js, 0, 0))
>timeout : Symbol(Timer.timeout, Decl(timer.js, 3, 25))
>timeout : Symbol(timeout, Decl(timer.js, 3, 15))
}
@@ -28,6 +30,8 @@ function Hook(handle) {
>handle : Symbol(handle, Decl(hook.js, 6, 14))
this.handle = handle;
+>this.handle : Symbol(Hook.handle, Decl(hook.js, 6, 23))
+>this : Symbol(Hook, Decl(hook.js, 0, 0))
>handle : Symbol(Hook.handle, Decl(hook.js, 6, 23))
>handle : Symbol(handle, Decl(hook.js, 6, 14))
}
diff --git a/tests/baselines/reference/jsDeclarationsFunctionClassesCjsExportAssignment.types b/tests/baselines/reference/jsDeclarationsFunctionClassesCjsExportAssignment.types
index 8b533ee291956..b374a4617523f 100644
--- a/tests/baselines/reference/jsDeclarationsFunctionClassesCjsExportAssignment.types
+++ b/tests/baselines/reference/jsDeclarationsFunctionClassesCjsExportAssignment.types
@@ -9,7 +9,7 @@ function Timer(timeout) {
this.timeout = timeout;
>this.timeout = timeout : number
>this.timeout : any
->this : any
+>this : this
>timeout : any
>timeout : number
}
@@ -34,7 +34,7 @@ function Hook(handle) {
this.handle = handle;
>this.handle = handle : (arg: import("tests/cases/conformance/jsdoc/declarations/context")) => void
>this.handle : any
->this : any
+>this : this
>handle : any
>handle : (arg: import("tests/cases/conformance/jsdoc/declarations/context")) => void
}
diff --git a/tests/baselines/reference/jsDeclarationsFunctionLikeClasses.symbols b/tests/baselines/reference/jsDeclarationsFunctionLikeClasses.symbols
index 61e0872f47979..178ee0761cc32 100644
--- a/tests/baselines/reference/jsDeclarationsFunctionLikeClasses.symbols
+++ b/tests/baselines/reference/jsDeclarationsFunctionLikeClasses.symbols
@@ -9,6 +9,7 @@ export function Point(x, y) {
>y : Symbol(y, Decl(source.js, 4, 24))
if (!(this instanceof Point)) {
+>this : Symbol(Point, Decl(source.js, 0, 0))
>Point : Symbol(Point, Decl(source.js, 0, 0))
return new Point(x, y);
@@ -17,10 +18,14 @@ export function Point(x, y) {
>y : Symbol(y, Decl(source.js, 4, 24))
}
this.x = x;
+>this.x : Symbol(Point.x, Decl(source.js, 7, 5))
+>this : Symbol(Point, Decl(source.js, 0, 0))
>x : Symbol(Point.x, Decl(source.js, 7, 5))
>x : Symbol(x, Decl(source.js, 4, 22))
this.y = y;
+>this.y : Symbol(Point.y, Decl(source.js, 8, 15))
+>this : Symbol(Point, Decl(source.js, 0, 0))
>y : Symbol(Point.y, Decl(source.js, 8, 15))
>y : Symbol(y, Decl(source.js, 4, 24))
}
diff --git a/tests/baselines/reference/jsDeclarationsFunctionLikeClasses.types b/tests/baselines/reference/jsDeclarationsFunctionLikeClasses.types
index 02ad20be62c8e..663c0ddc2dbd3 100644
--- a/tests/baselines/reference/jsDeclarationsFunctionLikeClasses.types
+++ b/tests/baselines/reference/jsDeclarationsFunctionLikeClasses.types
@@ -12,7 +12,7 @@ export function Point(x, y) {
>!(this instanceof Point) : boolean
>(this instanceof Point) : boolean
>this instanceof Point : boolean
->this : any
+>this : this
>Point : typeof Point
return new Point(x, y);
@@ -24,14 +24,14 @@ export function Point(x, y) {
this.x = x;
>this.x = x : number
>this.x : any
->this : any
+>this : this
>x : any
>x : number
this.y = y;
>this.y = y : number
>this.y : any
->this : any
+>this : this
>y : any
>y : number
}
diff --git a/tests/baselines/reference/jsDeclarationsFunctionLikeClasses2.symbols b/tests/baselines/reference/jsDeclarationsFunctionLikeClasses2.symbols
index 8e9894b37f96f..8ab6611dfa465 100644
--- a/tests/baselines/reference/jsDeclarationsFunctionLikeClasses2.symbols
+++ b/tests/baselines/reference/jsDeclarationsFunctionLikeClasses2.symbols
@@ -10,6 +10,8 @@ export function Vec(len) {
* @type {number[]}
*/
this.storage = new Array(len);
+>this.storage : Symbol(Vec.storage, Decl(source.js, 3, 26))
+>this : Symbol(Vec, Decl(source.js, 0, 0), Decl(source.js, 8, 1))
>storage : Symbol(Vec.storage, Decl(source.js, 3, 26))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>len : Symbol(len, Decl(source.js, 3, 20))
@@ -111,6 +113,7 @@ export function Point2D(x, y) {
>y : Symbol(y, Decl(source.js, 37, 26))
if (!(this instanceof Point2D)) {
+>this : Symbol(Point2D, Decl(source.js, 31, 1), Decl(source.js, 44, 1))
>Point2D : Symbol(Point2D, Decl(source.js, 31, 1), Decl(source.js, 44, 1))
return new Point2D(x, y);
@@ -122,12 +125,17 @@ export function Point2D(x, y) {
>Vec.call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --))
>Vec : Symbol(Vec, Decl(source.js, 0, 0), Decl(source.js, 8, 1))
>call : Symbol(Function.call, Decl(lib.es5.d.ts, --, --))
+>this : Symbol(Point2D, Decl(source.js, 31, 1), Decl(source.js, 44, 1))
this.x = x;
+>this.x : Symbol(Point2D.x, Decl(source.js, 41, 22), Decl(source.js, 47, 19), Decl(source.js, 50, 6))
+>this : Symbol(Point2D, Decl(source.js, 31, 1), Decl(source.js, 44, 1))
>x : Symbol(Point2D.x, Decl(source.js, 41, 22), Decl(source.js, 47, 19), Decl(source.js, 50, 6))
>x : Symbol(x, Decl(source.js, 37, 24))
this.y = y;
+>this.y : Symbol(Point2D.y, Decl(source.js, 42, 15), Decl(source.js, 56, 6), Decl(source.js, 59, 6))
+>this : Symbol(Point2D, Decl(source.js, 31, 1), Decl(source.js, 44, 1))
>y : Symbol(Point2D.y, Decl(source.js, 42, 15), Decl(source.js, 56, 6), Decl(source.js, 59, 6))
>y : Symbol(y, Decl(source.js, 37, 26))
}
diff --git a/tests/baselines/reference/jsDeclarationsFunctionLikeClasses2.types b/tests/baselines/reference/jsDeclarationsFunctionLikeClasses2.types
index 3e94d055ee249..bca10bf7a8858 100644
--- a/tests/baselines/reference/jsDeclarationsFunctionLikeClasses2.types
+++ b/tests/baselines/reference/jsDeclarationsFunctionLikeClasses2.types
@@ -11,9 +11,9 @@ export function Vec(len) {
*/
this.storage = new Array(len);
>this.storage = new Array(len) : any[]
->this.storage : any
->this : any
->storage : any
+>this.storage : number[]
+>this : this
+>storage : number[]
>new Array(len) : any[]
>Array : ArrayConstructor
>len : number
@@ -142,7 +142,7 @@ export function Point2D(x, y) {
>!(this instanceof Point2D) : boolean
>(this instanceof Point2D) : boolean
>this instanceof Point2D : boolean
->this : any
+>this : this
>Point2D : typeof Point2D
return new Point2D(x, y);
@@ -156,21 +156,21 @@ export function Point2D(x, y) {
>Vec.call : (this: Function, thisArg: any, ...argArray: any[]) => any
>Vec : typeof Vec
>call : (this: Function, thisArg: any, ...argArray: any[]) => any
->this : any
+>this : this
>2 : 2
this.x = x;
>this.x = x : number
->this.x : any
->this : any
->x : any
+>this.x : number
+>this : this
+>x : number
>x : number
this.y = y;
>this.y = y : number
->this.y : any
->this : any
->y : any
+>this.y : number
+>this : this
+>y : number
>y : number
}
diff --git a/tests/baselines/reference/jsFunctionWithPrototypeNoErrorTruncationNoCrash.symbols b/tests/baselines/reference/jsFunctionWithPrototypeNoErrorTruncationNoCrash.symbols
index d2bb8c9079c11..1c4c212e2adae 100644
--- a/tests/baselines/reference/jsFunctionWithPrototypeNoErrorTruncationNoCrash.symbols
+++ b/tests/baselines/reference/jsFunctionWithPrototypeNoErrorTruncationNoCrash.symbols
@@ -4,6 +4,8 @@ function Color(obj) {
>obj : Symbol(obj, Decl(index.js, 0, 15))
this.example = true
+>this.example : Symbol(Color.example, Decl(index.js, 0, 21))
+>this : Symbol(Color, Decl(index.js, 0, 0), Decl(index.js, 2, 2))
>example : Symbol(Color.example, Decl(index.js, 0, 21))
};
diff --git a/tests/baselines/reference/jsFunctionWithPrototypeNoErrorTruncationNoCrash.types b/tests/baselines/reference/jsFunctionWithPrototypeNoErrorTruncationNoCrash.types
index 5d547a666e87a..04f8a89c8b397 100644
--- a/tests/baselines/reference/jsFunctionWithPrototypeNoErrorTruncationNoCrash.types
+++ b/tests/baselines/reference/jsFunctionWithPrototypeNoErrorTruncationNoCrash.types
@@ -6,7 +6,7 @@ function Color(obj) {
this.example = true
>this.example = true : true
>this.example : any
->this : any
+>this : this
>example : any
>true : true
diff --git a/tests/baselines/reference/jsdocConstructorFunctionTypeReference.symbols b/tests/baselines/reference/jsdocConstructorFunctionTypeReference.symbols
index f4e58505c2e23..ef9292d4f8633 100644
--- a/tests/baselines/reference/jsdocConstructorFunctionTypeReference.symbols
+++ b/tests/baselines/reference/jsdocConstructorFunctionTypeReference.symbols
@@ -4,6 +4,8 @@ var Validator = function VFunc() {
>VFunc : Symbol(VFunc, Decl(jsdocConstructorFunctionTypeReference.js, 0, 15))
this.flags = "gim"
+>this.flags : Symbol(VFunc.flags, Decl(jsdocConstructorFunctionTypeReference.js, 0, 34))
+>this : Symbol(VFunc, Decl(jsdocConstructorFunctionTypeReference.js, 0, 15))
>flags : Symbol(VFunc.flags, Decl(jsdocConstructorFunctionTypeReference.js, 0, 34))
};
diff --git a/tests/baselines/reference/jsdocConstructorFunctionTypeReference.types b/tests/baselines/reference/jsdocConstructorFunctionTypeReference.types
index e7550faa72ecd..4cceb9c4ed383 100644
--- a/tests/baselines/reference/jsdocConstructorFunctionTypeReference.types
+++ b/tests/baselines/reference/jsdocConstructorFunctionTypeReference.types
@@ -7,7 +7,7 @@ var Validator = function VFunc() {
this.flags = "gim"
>this.flags = "gim" : "gim"
>this.flags : any
->this : any
+>this : this
>flags : any
>"gim" : "gim"
diff --git a/tests/baselines/reference/jsdocPrototypePropertyAccessWithType.errors.txt b/tests/baselines/reference/jsdocPrototypePropertyAccessWithType.errors.txt
new file mode 100644
index 0000000000000..02d48d1bb7732
--- /dev/null
+++ b/tests/baselines/reference/jsdocPrototypePropertyAccessWithType.errors.txt
@@ -0,0 +1,11 @@
+/a.js(1,16): error TS2322: Type 'boolean' is not assignable to type 'number'.
+
+
+==== /a.js (1 errors) ====
+ function C() { this.x = false; };
+ ~~~~~~
+!!! error TS2322: Type 'boolean' is not assignable to type 'number'.
+ /** @type {number} */
+ C.prototype.x;
+ new C().x;
+
\ No newline at end of file
diff --git a/tests/baselines/reference/jsdocPrototypePropertyAccessWithType.symbols b/tests/baselines/reference/jsdocPrototypePropertyAccessWithType.symbols
index 00e906ea4ad65..009004b201b31 100644
--- a/tests/baselines/reference/jsdocPrototypePropertyAccessWithType.symbols
+++ b/tests/baselines/reference/jsdocPrototypePropertyAccessWithType.symbols
@@ -1,6 +1,8 @@
=== /a.js ===
function C() { this.x = false; };
>C : Symbol(C, Decl(a.js, 0, 0))
+>this.x : Symbol(C.x, Decl(a.js, 0, 14), Decl(a.js, 0, 33))
+>this : Symbol(C, Decl(a.js, 0, 0))
>x : Symbol(C.x, Decl(a.js, 0, 14), Decl(a.js, 0, 33))
/** @type {number} */
diff --git a/tests/baselines/reference/jsdocPrototypePropertyAccessWithType.types b/tests/baselines/reference/jsdocPrototypePropertyAccessWithType.types
index 6756c07f231de..e2c5d088baaa2 100644
--- a/tests/baselines/reference/jsdocPrototypePropertyAccessWithType.types
+++ b/tests/baselines/reference/jsdocPrototypePropertyAccessWithType.types
@@ -2,9 +2,9 @@
function C() { this.x = false; };
>C : typeof C
>this.x = false : false
->this.x : any
->this : any
->x : any
+>this.x : number
+>this : this
+>x : number
>false : false
/** @type {number} */
diff --git a/tests/baselines/reference/jsdocReadonlyDeclarations.symbols b/tests/baselines/reference/jsdocReadonlyDeclarations.symbols
index 97c9d3d3ef3b8..2c100ca3303ed 100644
--- a/tests/baselines/reference/jsdocReadonlyDeclarations.symbols
+++ b/tests/baselines/reference/jsdocReadonlyDeclarations.symbols
@@ -37,6 +37,8 @@ function F() {
/** @readonly */
this.z = 1
+>this.z : Symbol(F.z, Decl(jsdocReadonlyDeclarations.js, 15, 14))
+>this : Symbol(F, Decl(jsdocReadonlyDeclarations.js, 13, 9))
>z : Symbol(F.z, Decl(jsdocReadonlyDeclarations.js, 15, 14))
}
diff --git a/tests/baselines/reference/jsdocReadonlyDeclarations.types b/tests/baselines/reference/jsdocReadonlyDeclarations.types
index 10e0a99c05e21..33e157ae5ad91 100644
--- a/tests/baselines/reference/jsdocReadonlyDeclarations.types
+++ b/tests/baselines/reference/jsdocReadonlyDeclarations.types
@@ -43,7 +43,7 @@ function F() {
this.z = 1
>this.z = 1 : 1
>this.z : any
->this : any
+>this : this
>z : any
>1 : 1
}
diff --git a/tests/baselines/reference/jsdocTemplateConstructorFunction.symbols b/tests/baselines/reference/jsdocTemplateConstructorFunction.symbols
index f9b5d1c6b6eb5..6ab42970bf96a 100644
--- a/tests/baselines/reference/jsdocTemplateConstructorFunction.symbols
+++ b/tests/baselines/reference/jsdocTemplateConstructorFunction.symbols
@@ -13,7 +13,13 @@ function Zet(t) {
/** @type {T} */
this.u
+>this.u : Symbol(Zet.u, Decl(templateTagOnConstructorFunctions.js, 8, 17), Decl(templateTagOnConstructorFunctions.js, 17, 37))
+>this : Symbol(Zet, Decl(templateTagOnConstructorFunctions.js, 0, 0))
+>u : Symbol(Zet.u, Decl(templateTagOnConstructorFunctions.js, 8, 17), Decl(templateTagOnConstructorFunctions.js, 17, 37))
+
this.t = t
+>this.t : Symbol(Zet.t, Decl(templateTagOnConstructorFunctions.js, 10, 10))
+>this : Symbol(Zet, Decl(templateTagOnConstructorFunctions.js, 0, 0))
>t : Symbol(Zet.t, Decl(templateTagOnConstructorFunctions.js, 10, 10))
>t : Symbol(t, Decl(templateTagOnConstructorFunctions.js, 8, 13))
}
diff --git a/tests/baselines/reference/jsdocTemplateConstructorFunction.types b/tests/baselines/reference/jsdocTemplateConstructorFunction.types
index 6caba31540c18..018054de5bc72 100644
--- a/tests/baselines/reference/jsdocTemplateConstructorFunction.types
+++ b/tests/baselines/reference/jsdocTemplateConstructorFunction.types
@@ -13,14 +13,14 @@ function Zet(t) {
/** @type {T} */
this.u
->this.u : any
->this : any
->u : any
+>this.u : T
+>this : this
+>u : T
this.t = t
>this.t = t : T
>this.t : any
->this : any
+>this : this
>t : any
>t : T
}
diff --git a/tests/baselines/reference/jsdocTemplateConstructorFunction2.symbols b/tests/baselines/reference/jsdocTemplateConstructorFunction2.symbols
index 41211488656d1..beb90c1b76248 100644
--- a/tests/baselines/reference/jsdocTemplateConstructorFunction2.symbols
+++ b/tests/baselines/reference/jsdocTemplateConstructorFunction2.symbols
@@ -9,7 +9,13 @@ function Zet(t) {
/** @type {T} */
this.u
+>this.u : Symbol(Zet.u, Decl(templateTagWithNestedTypeLiteral.js, 4, 17), Decl(templateTagWithNestedTypeLiteral.js, 14, 36))
+>this : Symbol(Zet, Decl(templateTagWithNestedTypeLiteral.js, 0, 0))
+>u : Symbol(Zet.u, Decl(templateTagWithNestedTypeLiteral.js, 4, 17), Decl(templateTagWithNestedTypeLiteral.js, 14, 36))
+
this.t = t
+>this.t : Symbol(Zet.t, Decl(templateTagWithNestedTypeLiteral.js, 6, 10))
+>this : Symbol(Zet, Decl(templateTagWithNestedTypeLiteral.js, 0, 0))
>t : Symbol(Zet.t, Decl(templateTagWithNestedTypeLiteral.js, 6, 10))
>t : Symbol(t, Decl(templateTagWithNestedTypeLiteral.js, 4, 13))
}
diff --git a/tests/baselines/reference/jsdocTemplateConstructorFunction2.types b/tests/baselines/reference/jsdocTemplateConstructorFunction2.types
index dc70e5282c31f..316981e10afd8 100644
--- a/tests/baselines/reference/jsdocTemplateConstructorFunction2.types
+++ b/tests/baselines/reference/jsdocTemplateConstructorFunction2.types
@@ -9,14 +9,14 @@ function Zet(t) {
/** @type {T} */
this.u
->this.u : any
->this : any
->u : any
+>this.u : T
+>this : this
+>u : T
this.t = t
>this.t = t : T
>this.t : any
->this : any
+>this : this
>t : any
>t : T
}
diff --git a/tests/baselines/reference/jsdocTypeFromChainedAssignment.symbols b/tests/baselines/reference/jsdocTypeFromChainedAssignment.symbols
index 5b1be631fd966..0107dfaad739b 100644
--- a/tests/baselines/reference/jsdocTypeFromChainedAssignment.symbols
+++ b/tests/baselines/reference/jsdocTypeFromChainedAssignment.symbols
@@ -3,11 +3,17 @@ function A () {
>A : Symbol(A, Decl(a.js, 0, 0), Decl(a.js, 8, 1), Decl(a.js, 10, 5))
this.x = 1
+>this.x : Symbol(A.x, Decl(a.js, 0, 15))
+>this : Symbol(A, Decl(a.js, 0, 0), Decl(a.js, 8, 1), Decl(a.js, 10, 5))
>x : Symbol(A.x, Decl(a.js, 0, 15))
/** @type {1} */
this.first = this.second = 1
+>this.first : Symbol(A.first, Decl(a.js, 1, 14))
+>this : Symbol(A, Decl(a.js, 0, 0), Decl(a.js, 8, 1), Decl(a.js, 10, 5))
>first : Symbol(A.first, Decl(a.js, 1, 14))
+>this.second : Symbol(A.second, Decl(a.js, 3, 16))
+>this : Symbol(A, Decl(a.js, 0, 0), Decl(a.js, 8, 1), Decl(a.js, 10, 5))
>second : Symbol(A.second, Decl(a.js, 3, 16))
}
/** @param {number} n */
diff --git a/tests/baselines/reference/jsdocTypeFromChainedAssignment.types b/tests/baselines/reference/jsdocTypeFromChainedAssignment.types
index 974ba2b1cdd8d..6cc9c457e57b0 100644
--- a/tests/baselines/reference/jsdocTypeFromChainedAssignment.types
+++ b/tests/baselines/reference/jsdocTypeFromChainedAssignment.types
@@ -5,20 +5,20 @@ function A () {
this.x = 1
>this.x = 1 : 1
>this.x : any
->this : any
+>this : this
>x : any
>1 : 1
/** @type {1} */
this.first = this.second = 1
>this.first = this.second = 1 : 1
->this.first : any
->this : any
->first : any
+>this.first : 1
+>this : this
+>first : 1
>this.second = 1 : 1
->this.second : any
->this : any
->second : any
+>this.second : 1
+>this : this
+>second : 1
>1 : 1
}
/** @param {number} n */
diff --git a/tests/baselines/reference/jsdocTypeTagCast.symbols b/tests/baselines/reference/jsdocTypeTagCast.symbols
index 679470b4c9c6b..5c4fbefb2c707 100644
--- a/tests/baselines/reference/jsdocTypeTagCast.symbols
+++ b/tests/baselines/reference/jsdocTypeTagCast.symbols
@@ -64,6 +64,8 @@ function SomeFakeClass() {
/** @type {string|number} */
this.p = "bar";
+>this.p : Symbol(SomeFakeClass.p, Decl(b.js, 31, 26))
+>this : Symbol(SomeFakeClass, Decl(b.js, 29, 1))
>p : Symbol(SomeFakeClass.p, Decl(b.js, 31, 26))
}
diff --git a/tests/baselines/reference/jsdocTypeTagCast.types b/tests/baselines/reference/jsdocTypeTagCast.types
index f7e9136ca34f5..5a330825aea61 100644
--- a/tests/baselines/reference/jsdocTypeTagCast.types
+++ b/tests/baselines/reference/jsdocTypeTagCast.types
@@ -85,9 +85,9 @@ function SomeFakeClass() {
/** @type {string|number} */
this.p = "bar";
>this.p = "bar" : "bar"
->this.p : any
->this : any
->p : any
+>this.p : string | number
+>this : this
+>p : string | number
>"bar" : "bar"
}
diff --git a/tests/baselines/reference/moduleExportAlias2.symbols b/tests/baselines/reference/moduleExportAlias2.symbols
index 6dc88d4d8c992..3571a6760e191 100644
--- a/tests/baselines/reference/moduleExportAlias2.symbols
+++ b/tests/baselines/reference/moduleExportAlias2.symbols
@@ -47,5 +47,7 @@ function C() {
>C : Symbol(C, Decl(semver.js, 2, 22))
this.p = 1
+>this.p : Symbol(C.p, Decl(semver.js, 3, 14))
+>this : Symbol(C, Decl(semver.js, 2, 22))
>p : Symbol(C.p, Decl(semver.js, 3, 14))
}
diff --git a/tests/baselines/reference/moduleExportAlias2.types b/tests/baselines/reference/moduleExportAlias2.types
index 44b04455aa4f4..6552d86075414 100644
--- a/tests/baselines/reference/moduleExportAlias2.types
+++ b/tests/baselines/reference/moduleExportAlias2.types
@@ -59,7 +59,7 @@ function C() {
this.p = 1
>this.p = 1 : 1
>this.p : any
->this : any
+>this : this
>p : any
>1 : 1
}
diff --git a/tests/baselines/reference/moduleExportNestedNamespaces.symbols b/tests/baselines/reference/moduleExportNestedNamespaces.symbols
index 0472ea186b0e6..2ed7db8d2879b 100644
--- a/tests/baselines/reference/moduleExportNestedNamespaces.symbols
+++ b/tests/baselines/reference/moduleExportNestedNamespaces.symbols
@@ -17,7 +17,8 @@ module.exports.n.K = function C() {
>C : Symbol(C, Decl(mod.js, 1, 20))
this.x = 10;
->this : Symbol(n, Decl(mod.js, 0, 0), Decl(mod.js, 1, 15))
+>this.x : Symbol(C.x, Decl(mod.js, 1, 35))
+>this : Symbol(C, Decl(mod.js, 1, 20))
>x : Symbol(C.x, Decl(mod.js, 1, 35))
}
module.exports.Classic = class {
diff --git a/tests/baselines/reference/moduleExportNestedNamespaces.types b/tests/baselines/reference/moduleExportNestedNamespaces.types
index 5a266b23277a4..7da94f8a29dbd 100644
--- a/tests/baselines/reference/moduleExportNestedNamespaces.types
+++ b/tests/baselines/reference/moduleExportNestedNamespaces.types
@@ -23,7 +23,7 @@ module.exports.n.K = function C() {
this.x = 10;
>this.x = 10 : 10
>this.x : any
->this : typeof n
+>this : this
>x : any
>10 : 10
}
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.symbols b/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.symbols
index 76fecbc0b2c69..82277b0540a63 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.symbols
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.symbols
@@ -72,6 +72,8 @@ function A() {
>A : Symbol(A, Decl(mod1.js, 5, 18), Decl(mod1.js, 1, 36), Decl(mod1.js, 2, 16), Decl(mod1.js, 3, 16))
this.p = 1
+>this.p : Symbol(A.p, Decl(mod1.js, 6, 14))
+>this : Symbol(A, Decl(mod1.js, 5, 18), Decl(mod1.js, 1, 36), Decl(mod1.js, 2, 16), Decl(mod1.js, 3, 16))
>p : Symbol(A.p, Decl(mod1.js, 6, 14))
}
module.exports.bothAfter = 'string'
diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.types b/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.types
index 41b03e786d0e1..0ddaff1d58a90 100644
--- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.types
+++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment4.types
@@ -91,7 +91,7 @@ function A() {
this.p = 1
>this.p = 1 : 1
>this.p : any
->this : any
+>this : this
>p : any
>1 : 1
}
diff --git a/tests/baselines/reference/multipleDeclarations.symbols b/tests/baselines/reference/multipleDeclarations.symbols
index b33ebc0222fb3..2c2b60fb6ab1b 100644
--- a/tests/baselines/reference/multipleDeclarations.symbols
+++ b/tests/baselines/reference/multipleDeclarations.symbols
@@ -3,6 +3,8 @@ function C() {
>C : Symbol(C, Decl(input.js, 0, 0))
this.m = null;
+>this.m : Symbol(C.m, Decl(input.js, 0, 14))
+>this : Symbol(C, Decl(input.js, 0, 0))
>m : Symbol(C.m, Decl(input.js, 0, 14))
}
C.prototype.m = function() {
diff --git a/tests/baselines/reference/multipleDeclarations.types b/tests/baselines/reference/multipleDeclarations.types
index 445d737019e11..12aa74ecaf096 100644
--- a/tests/baselines/reference/multipleDeclarations.types
+++ b/tests/baselines/reference/multipleDeclarations.types
@@ -5,7 +5,7 @@ function C() {
this.m = null;
>this.m = null : null
>this.m : any
->this : any
+>this : this
>m : any
>null : null
}
diff --git a/tests/baselines/reference/privateConstructorFunction.symbols b/tests/baselines/reference/privateConstructorFunction.symbols
index 32e8406918dd6..9ed75eead7b05 100644
--- a/tests/baselines/reference/privateConstructorFunction.symbols
+++ b/tests/baselines/reference/privateConstructorFunction.symbols
@@ -8,6 +8,8 @@
>C : Symbol(C, Decl(privateConstructorFunction.js, 0, 1))
this.x = 1
+>this.x : Symbol(C.x, Decl(privateConstructorFunction.js, 5, 18))
+>this : Symbol(C, Decl(privateConstructorFunction.js, 0, 1))
>x : Symbol(C.x, Decl(privateConstructorFunction.js, 5, 18))
}
new C()
diff --git a/tests/baselines/reference/privateConstructorFunction.types b/tests/baselines/reference/privateConstructorFunction.types
index 19fae01d8eb84..5f4919e57de5a 100644
--- a/tests/baselines/reference/privateConstructorFunction.types
+++ b/tests/baselines/reference/privateConstructorFunction.types
@@ -10,7 +10,7 @@
this.x = 1
>this.x = 1 : 1
>this.x : any
->this : any
+>this : this
>x : any
>1 : 1
}
diff --git a/tests/baselines/reference/propertiesOfGenericConstructorFunctions.symbols b/tests/baselines/reference/propertiesOfGenericConstructorFunctions.symbols
index 48606c4b15c1b..62d7c98235f5c 100644
--- a/tests/baselines/reference/propertiesOfGenericConstructorFunctions.symbols
+++ b/tests/baselines/reference/propertiesOfGenericConstructorFunctions.symbols
@@ -12,10 +12,14 @@ function Multimap(ik, iv) {
/** @type {{ [s: string]: V }} */
this._map = {};
+>this._map : Symbol(Multimap._map, Decl(propertiesOfGenericConstructorFunctions.js, 6, 27))
+>this : Symbol(Multimap, Decl(propertiesOfGenericConstructorFunctions.js, 0, 0))
>_map : Symbol(Multimap._map, Decl(propertiesOfGenericConstructorFunctions.js, 6, 27))
// without type annotation
this._map2 = { [ik]: iv };
+>this._map2 : Symbol(Multimap._map2, Decl(propertiesOfGenericConstructorFunctions.js, 8, 19))
+>this : Symbol(Multimap, Decl(propertiesOfGenericConstructorFunctions.js, 0, 0))
>_map2 : Symbol(Multimap._map2, Decl(propertiesOfGenericConstructorFunctions.js, 8, 19))
>[ik] : Symbol([ik], Decl(propertiesOfGenericConstructorFunctions.js, 10, 18))
>ik : Symbol(ik, Decl(propertiesOfGenericConstructorFunctions.js, 6, 18))
diff --git a/tests/baselines/reference/propertiesOfGenericConstructorFunctions.types b/tests/baselines/reference/propertiesOfGenericConstructorFunctions.types
index 42bf2ea2e9459..8ac0f3f98bed4 100644
--- a/tests/baselines/reference/propertiesOfGenericConstructorFunctions.types
+++ b/tests/baselines/reference/propertiesOfGenericConstructorFunctions.types
@@ -13,16 +13,16 @@ function Multimap(ik, iv) {
/** @type {{ [s: string]: V }} */
this._map = {};
>this._map = {} : {}
->this._map : any
->this : any
->_map : any
+>this._map : { [s: string]: V; }
+>this : this
+>_map : { [s: string]: V; }
>{} : {}
// without type annotation
this._map2 = { [ik]: iv };
>this._map2 = { [ik]: iv } : { [x: string]: V; }
>this._map2 : any
->this : any
+>this : this
>_map2 : any
>{ [ik]: iv } : { [x: string]: V; }
>[ik] : V
diff --git a/tests/baselines/reference/prototypePropertyAssignmentMergeAcrossFiles.symbols b/tests/baselines/reference/prototypePropertyAssignmentMergeAcrossFiles.symbols
index 087d83cb6b3eb..8d3f4d9231c40 100644
--- a/tests/baselines/reference/prototypePropertyAssignmentMergeAcrossFiles.symbols
+++ b/tests/baselines/reference/prototypePropertyAssignmentMergeAcrossFiles.symbols
@@ -3,6 +3,8 @@ function C() {
>C : Symbol(C, Decl(prototypePropertyAssignmentMergeAcrossFiles.js, 0, 0))
this.a = 1
+>this.a : Symbol(C.a, Decl(prototypePropertyAssignmentMergeAcrossFiles.js, 0, 14))
+>this : Symbol(C, Decl(prototypePropertyAssignmentMergeAcrossFiles.js, 0, 0))
>a : Symbol(C.a, Decl(prototypePropertyAssignmentMergeAcrossFiles.js, 0, 14))
}
diff --git a/tests/baselines/reference/prototypePropertyAssignmentMergeAcrossFiles.types b/tests/baselines/reference/prototypePropertyAssignmentMergeAcrossFiles.types
index 8e399f618b985..c31cc2c5cc548 100644
--- a/tests/baselines/reference/prototypePropertyAssignmentMergeAcrossFiles.types
+++ b/tests/baselines/reference/prototypePropertyAssignmentMergeAcrossFiles.types
@@ -5,7 +5,7 @@ function C() {
this.a = 1
>this.a = 1 : 1
>this.a : any
->this : any
+>this : this
>a : any
>1 : 1
}
diff --git a/tests/baselines/reference/signaturesUseJSDocForOptionalParameters.symbols b/tests/baselines/reference/signaturesUseJSDocForOptionalParameters.symbols
index 2599ea3f207c5..8b7d84611f36e 100644
--- a/tests/baselines/reference/signaturesUseJSDocForOptionalParameters.symbols
+++ b/tests/baselines/reference/signaturesUseJSDocForOptionalParameters.symbols
@@ -3,6 +3,8 @@ function MyClass() {
>MyClass : Symbol(MyClass, Decl(jsDocOptionality.js, 0, 0))
this.prop = null;
+>this.prop : Symbol(MyClass.prop, Decl(jsDocOptionality.js, 0, 20))
+>this : Symbol(MyClass, Decl(jsDocOptionality.js, 0, 0))
>prop : Symbol(MyClass.prop, Decl(jsDocOptionality.js, 0, 20))
}
/**
diff --git a/tests/baselines/reference/signaturesUseJSDocForOptionalParameters.types b/tests/baselines/reference/signaturesUseJSDocForOptionalParameters.types
index d1bdb0611bcdd..7d4bd7cd2b030 100644
--- a/tests/baselines/reference/signaturesUseJSDocForOptionalParameters.types
+++ b/tests/baselines/reference/signaturesUseJSDocForOptionalParameters.types
@@ -5,7 +5,7 @@ function MyClass() {
this.prop = null;
>this.prop = null : null
>this.prop : any
->this : any
+>this : this
>prop : any
>null : null
}
diff --git a/tests/baselines/reference/typeFromJSConstructor.symbols b/tests/baselines/reference/typeFromJSConstructor.symbols
index eaaf1f2e1765f..a2d5866f9abf5 100644
--- a/tests/baselines/reference/typeFromJSConstructor.symbols
+++ b/tests/baselines/reference/typeFromJSConstructor.symbols
@@ -4,25 +4,37 @@ function Installer () {
// arg: number
this.arg = 0
+>this.arg : Symbol(Installer.arg, Decl(a.js, 0, 23), Decl(a.js, 12, 41), Decl(a.js, 19, 42))
+>this : Symbol(Installer, Decl(a.js, 0, 0))
>arg : Symbol(Installer.arg, Decl(a.js, 0, 23), Decl(a.js, 12, 41), Decl(a.js, 19, 42))
// unknown: string | boolean | null
this.unknown = null
+>this.unknown : Symbol(Installer.unknown, Decl(a.js, 2, 16), Decl(a.js, 13, 19), Decl(a.js, 20, 20))
+>this : Symbol(Installer, Decl(a.js, 0, 0))
>unknown : Symbol(Installer.unknown, Decl(a.js, 2, 16), Decl(a.js, 13, 19), Decl(a.js, 20, 20))
// twice: string | undefined
this.twice = undefined
+>this.twice : Symbol(Installer.twice, Decl(a.js, 4, 23), Decl(a.js, 6, 26), Decl(a.js, 15, 24), Decl(a.js, 16, 26), Decl(a.js, 22, 28) ... and 1 more)
+>this : Symbol(Installer, Decl(a.js, 0, 0))
>twice : Symbol(Installer.twice, Decl(a.js, 4, 23), Decl(a.js, 6, 26), Decl(a.js, 15, 24), Decl(a.js, 16, 26), Decl(a.js, 22, 28) ... and 1 more)
>undefined : Symbol(undefined)
this.twice = 'hi'
+>this.twice : Symbol(Installer.twice, Decl(a.js, 4, 23), Decl(a.js, 6, 26), Decl(a.js, 15, 24), Decl(a.js, 16, 26), Decl(a.js, 22, 28) ... and 1 more)
+>this : Symbol(Installer, Decl(a.js, 0, 0))
>twice : Symbol(Installer.twice, Decl(a.js, 4, 23), Decl(a.js, 6, 26), Decl(a.js, 15, 24), Decl(a.js, 16, 26), Decl(a.js, 22, 28) ... and 1 more)
// twices: any[] | null
this.twices = []
+>this.twices : Symbol(Installer.twices, Decl(a.js, 7, 21), Decl(a.js, 9, 20))
+>this : Symbol(Installer, Decl(a.js, 0, 0))
>twices : Symbol(Installer.twices, Decl(a.js, 7, 21), Decl(a.js, 9, 20))
this.twices = null
+>this.twices : Symbol(Installer.twices, Decl(a.js, 7, 21), Decl(a.js, 9, 20))
+>this : Symbol(Installer, Decl(a.js, 0, 0))
>twices : Symbol(Installer.twices, Decl(a.js, 7, 21), Decl(a.js, 9, 20))
}
Installer.prototype.first = function () {
diff --git a/tests/baselines/reference/typeFromJSConstructor.types b/tests/baselines/reference/typeFromJSConstructor.types
index 68bd498f0f265..e5c951ce3d8b0 100644
--- a/tests/baselines/reference/typeFromJSConstructor.types
+++ b/tests/baselines/reference/typeFromJSConstructor.types
@@ -6,7 +6,7 @@ function Installer () {
this.arg = 0
>this.arg = 0 : 0
>this.arg : any
->this : any
+>this : this
>arg : any
>0 : 0
@@ -14,7 +14,7 @@ function Installer () {
this.unknown = null
>this.unknown = null : null
>this.unknown : any
->this : any
+>this : this
>unknown : any
>null : null
@@ -22,14 +22,14 @@ function Installer () {
this.twice = undefined
>this.twice = undefined : undefined
>this.twice : any
->this : any
+>this : this
>twice : any
>undefined : undefined
this.twice = 'hi'
>this.twice = 'hi' : "hi"
>this.twice : any
->this : any
+>this : this
>twice : any
>'hi' : "hi"
@@ -37,14 +37,14 @@ function Installer () {
this.twices = []
>this.twices = [] : never[]
>this.twices : any
->this : any
+>this : this
>twices : any
>[] : never[]
this.twices = null
>this.twices = null : null
>this.twices : any
->this : any
+>this : this
>twices : any
>null : null
}
diff --git a/tests/baselines/reference/typeFromJSInitializer.symbols b/tests/baselines/reference/typeFromJSInitializer.symbols
index b4bc995084738..2de03afed251a 100644
--- a/tests/baselines/reference/typeFromJSInitializer.symbols
+++ b/tests/baselines/reference/typeFromJSInitializer.symbols
@@ -4,13 +4,19 @@ function A () {
// should get any on this-assignments in constructor
this.unknown = null
+>this.unknown : Symbol(A.unknown, Decl(a.js, 0, 15))
+>this : Symbol(A, Decl(a.js, 0, 0))
>unknown : Symbol(A.unknown, Decl(a.js, 0, 15))
this.unknowable = undefined
+>this.unknowable : Symbol(A.unknowable, Decl(a.js, 2, 23))
+>this : Symbol(A, Decl(a.js, 0, 0))
>unknowable : Symbol(A.unknowable, Decl(a.js, 2, 23))
>undefined : Symbol(undefined)
this.empty = []
+>this.empty : Symbol(A.empty, Decl(a.js, 3, 31))
+>this : Symbol(A, Decl(a.js, 0, 0))
>empty : Symbol(A.empty, Decl(a.js, 3, 31))
}
var a = new A()
diff --git a/tests/baselines/reference/typeFromJSInitializer.types b/tests/baselines/reference/typeFromJSInitializer.types
index 39bc8a9214633..2ed8238859859 100644
--- a/tests/baselines/reference/typeFromJSInitializer.types
+++ b/tests/baselines/reference/typeFromJSInitializer.types
@@ -6,21 +6,21 @@ function A () {
this.unknown = null
>this.unknown = null : null
>this.unknown : any
->this : any
+>this : this
>unknown : any
>null : null
this.unknowable = undefined
>this.unknowable = undefined : undefined
>this.unknowable : any
->this : any
+>this : this
>unknowable : any
>undefined : undefined
this.empty = []
>this.empty = [] : never[]
>this.empty : any
->this : any
+>this : this
>empty : any
>[] : never[]
}
diff --git a/tests/baselines/reference/typeFromParamTagForFunction.symbols b/tests/baselines/reference/typeFromParamTagForFunction.symbols
index e26674cf33153..9f655be0bb991 100644
--- a/tests/baselines/reference/typeFromParamTagForFunction.symbols
+++ b/tests/baselines/reference/typeFromParamTagForFunction.symbols
@@ -14,6 +14,8 @@ exports.A = function () {
>A : Symbol(A, Decl(a-ext.js, 0, 0))
this.x = 1;
+>this.x : Symbol(A.x, Decl(a-ext.js, 0, 25))
+>this : Symbol(A, Decl(a-ext.js, 0, 11))
>x : Symbol(A.x, Decl(a-ext.js, 0, 25))
};
@@ -65,6 +67,8 @@ export function C() {
>C : Symbol(C, Decl(c-ext.js, 0, 0))
this.x = 1;
+>this.x : Symbol(C.x, Decl(c-ext.js, 0, 21))
+>this : Symbol(C, Decl(c-ext.js, 0, 0))
>x : Symbol(C.x, Decl(c-ext.js, 0, 21))
}
@@ -87,6 +91,8 @@ export var D = function() {
>D : Symbol(D, Decl(d-ext.js, 0, 10))
this.x = 1;
+>this.x : Symbol(D.x, Decl(d-ext.js, 0, 27))
+>this : Symbol(D, Decl(d-ext.js, 0, 14))
>x : Symbol(D.x, Decl(d-ext.js, 0, 27))
};
@@ -136,6 +142,8 @@ var F = function () {
>F : Symbol(F, Decl(f.js, 0, 3))
this.x = 1;
+>this.x : Symbol(F.x, Decl(f.js, 0, 21))
+>this : Symbol(F, Decl(f.js, 0, 7))
>x : Symbol(F.x, Decl(f.js, 0, 21))
};
@@ -153,6 +161,8 @@ function G() {
>G : Symbol(G, Decl(g.js, 0, 0))
this.x = 1;
+>this.x : Symbol(G.x, Decl(g.js, 0, 14))
+>this : Symbol(G, Decl(g.js, 0, 0))
>x : Symbol(G.x, Decl(g.js, 0, 14))
}
diff --git a/tests/baselines/reference/typeFromParamTagForFunction.types b/tests/baselines/reference/typeFromParamTagForFunction.types
index 2c454f3e0da4b..73daa299cf1be 100644
--- a/tests/baselines/reference/typeFromParamTagForFunction.types
+++ b/tests/baselines/reference/typeFromParamTagForFunction.types
@@ -18,7 +18,7 @@ exports.A = function () {
this.x = 1;
>this.x = 1 : 1
>this.x : any
->this : any
+>this : this
>x : any
>1 : 1
@@ -79,7 +79,7 @@ export function C() {
this.x = 1;
>this.x = 1 : 1
>this.x : any
->this : any
+>this : this
>x : any
>1 : 1
}
@@ -107,7 +107,7 @@ export var D = function() {
this.x = 1;
>this.x = 1 : 1
>this.x : any
->this : any
+>this : this
>x : any
>1 : 1
@@ -165,7 +165,7 @@ var F = function () {
this.x = 1;
>this.x = 1 : 1
>this.x : any
->this : any
+>this : this
>x : any
>1 : 1
@@ -186,7 +186,7 @@ function G() {
this.x = 1;
>this.x = 1 : 1
>this.x : any
->this : any
+>this : this
>x : any
>1 : 1
}
diff --git a/tests/baselines/reference/typeFromPropertyAssignment19.symbols b/tests/baselines/reference/typeFromPropertyAssignment19.symbols
index 39361e90c5f4c..4b89af4a62eef 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment19.symbols
+++ b/tests/baselines/reference/typeFromPropertyAssignment19.symbols
@@ -38,5 +38,7 @@ function C() {
>C : Symbol(C, Decl(semver.js, 2, 16), Decl(semver.js, 1, 28))
this.p = 1
+>this.p : Symbol(C.p, Decl(semver.js, 3, 14))
+>this : Symbol(C, Decl(semver.js, 2, 16), Decl(semver.js, 1, 28))
>p : Symbol(C.p, Decl(semver.js, 3, 14))
}
diff --git a/tests/baselines/reference/typeFromPropertyAssignment19.types b/tests/baselines/reference/typeFromPropertyAssignment19.types
index d3ca43ee0e275..d09029fb94954 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment19.types
+++ b/tests/baselines/reference/typeFromPropertyAssignment19.types
@@ -49,7 +49,7 @@ function C() {
this.p = 1
>this.p = 1 : 1
>this.p : any
->this : any
+>this : this
>p : any
>1 : 1
}
diff --git a/tests/baselines/reference/typeFromPropertyAssignment2.symbols b/tests/baselines/reference/typeFromPropertyAssignment2.symbols
index 8b73ba10d3ca5..76d88fb41b4ee 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment2.symbols
+++ b/tests/baselines/reference/typeFromPropertyAssignment2.symbols
@@ -3,6 +3,8 @@ function Outer() {
>Outer : Symbol(Outer, Decl(a.js, 0, 0), Decl(a.js, 2, 1))
this.y = 2
+>this.y : Symbol(Outer.y, Decl(a.js, 0, 18))
+>this : Symbol(Outer, Decl(a.js, 0, 0), Decl(a.js, 2, 1))
>y : Symbol(Outer.y, Decl(a.js, 0, 18))
}
Outer.Inner = class I {
diff --git a/tests/baselines/reference/typeFromPropertyAssignment2.types b/tests/baselines/reference/typeFromPropertyAssignment2.types
index aa06b79f4844b..bd1b69ea6688f 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment2.types
+++ b/tests/baselines/reference/typeFromPropertyAssignment2.types
@@ -5,7 +5,7 @@ function Outer() {
this.y = 2
>this.y = 2 : 2
>this.y : any
->this : any
+>this : this
>y : any
>2 : 2
}
diff --git a/tests/baselines/reference/typeFromPropertyAssignment20.symbols b/tests/baselines/reference/typeFromPropertyAssignment20.symbols
index f2a10e59e4d88..80bc5c2b6bd2c 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment20.symbols
+++ b/tests/baselines/reference/typeFromPropertyAssignment20.symbols
@@ -11,6 +11,8 @@
>Async : Symbol(Async, Decl(bluebird.js, 1, 23))
this._trampolineEnabled = true;
+>this._trampolineEnabled : Symbol(Async._trampolineEnabled, Decl(bluebird.js, 2, 26), Decl(bluebird.js, 7, 20))
+>this : Symbol(Async, Decl(bluebird.js, 1, 23))
>_trampolineEnabled : Symbol(Async._trampolineEnabled, Decl(bluebird.js, 2, 26), Decl(bluebird.js, 7, 20))
}
diff --git a/tests/baselines/reference/typeFromPropertyAssignment20.types b/tests/baselines/reference/typeFromPropertyAssignment20.types
index 32e1b541d7b40..314adfa9241ba 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment20.types
+++ b/tests/baselines/reference/typeFromPropertyAssignment20.types
@@ -17,7 +17,7 @@
this._trampolineEnabled = true;
>this._trampolineEnabled = true : true
>this._trampolineEnabled : any
->this : any
+>this : this
>_trampolineEnabled : any
>true : true
}
diff --git a/tests/baselines/reference/typeFromPropertyAssignment22.symbols b/tests/baselines/reference/typeFromPropertyAssignment22.symbols
index fbdfb304f2cd0..ae7614560cdbd 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment22.symbols
+++ b/tests/baselines/reference/typeFromPropertyAssignment22.symbols
@@ -3,6 +3,8 @@ function Installer () {
>Installer : Symbol(Installer, Decl(npm-install.js, 0, 0))
this.args = 0
+>this.args : Symbol(Installer.args, Decl(npm-install.js, 0, 23), Decl(npm-install.js, 5, 15))
+>this : Symbol(Installer, Decl(npm-install.js, 0, 0))
>args : Symbol(Installer.args, Decl(npm-install.js, 0, 23), Decl(npm-install.js, 5, 15))
}
Installer.prototype.loadArgMetadata = function (next) {
diff --git a/tests/baselines/reference/typeFromPropertyAssignment22.types b/tests/baselines/reference/typeFromPropertyAssignment22.types
index 1c4d6822578d0..b5439042e0e22 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment22.types
+++ b/tests/baselines/reference/typeFromPropertyAssignment22.types
@@ -5,7 +5,7 @@ function Installer () {
this.args = 0
>this.args = 0 : 0
>this.args : any
->this : any
+>this : this
>args : any
>0 : 0
}
diff --git a/tests/baselines/reference/typeFromPropertyAssignment27.symbols b/tests/baselines/reference/typeFromPropertyAssignment27.symbols
index e76f61b2bbc0c..ffefbaa4591b2 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment27.symbols
+++ b/tests/baselines/reference/typeFromPropertyAssignment27.symbols
@@ -2,6 +2,8 @@
// mixed prototype-assignment+function declaration
function C() { this.p = 1; }
>C : Symbol(C, Decl(a.js, 0, 0), Decl(a.js, 1, 28))
+>this.p : Symbol(C.p, Decl(a.js, 1, 14))
+>this : Symbol(C, Decl(a.js, 0, 0), Decl(a.js, 1, 28))
>p : Symbol(C.p, Decl(a.js, 1, 14))
C.prototype = { q: 2 };
diff --git a/tests/baselines/reference/typeFromPropertyAssignment27.types b/tests/baselines/reference/typeFromPropertyAssignment27.types
index 956979e805af9..b49799d9caed1 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment27.types
+++ b/tests/baselines/reference/typeFromPropertyAssignment27.types
@@ -4,7 +4,7 @@ function C() { this.p = 1; }
>C : typeof C
>this.p = 1 : 1
>this.p : any
->this : any
+>this : this
>p : any
>1 : 1
diff --git a/tests/baselines/reference/typeFromPropertyAssignment3.symbols b/tests/baselines/reference/typeFromPropertyAssignment3.symbols
index b3353e034ad55..96ea0270eb01e 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment3.symbols
+++ b/tests/baselines/reference/typeFromPropertyAssignment3.symbols
@@ -4,6 +4,8 @@ var Outer = function O() {
>O : Symbol(O, Decl(a.js, 0, 11))
this.y = 2
+>this.y : Symbol(O.y, Decl(a.js, 0, 26))
+>this : Symbol(O, Decl(a.js, 0, 11))
>y : Symbol(O.y, Decl(a.js, 0, 26))
}
Outer.Inner = class I {
diff --git a/tests/baselines/reference/typeFromPropertyAssignment3.types b/tests/baselines/reference/typeFromPropertyAssignment3.types
index 510296439c894..500c290adcf9a 100644
--- a/tests/baselines/reference/typeFromPropertyAssignment3.types
+++ b/tests/baselines/reference/typeFromPropertyAssignment3.types
@@ -7,7 +7,7 @@ var Outer = function O() {
this.y = 2
>this.y = 2 : 2
>this.y : any
->this : any
+>this : this
>y : any
>2 : 2
}
diff --git a/tests/baselines/reference/typeFromPrototypeAssignment3.errors.txt b/tests/baselines/reference/typeFromPrototypeAssignment3.errors.txt
index 02ff4ae344cd4..d6aa97451b276 100644
--- a/tests/baselines/reference/typeFromPrototypeAssignment3.errors.txt
+++ b/tests/baselines/reference/typeFromPrototypeAssignment3.errors.txt
@@ -1,13 +1,10 @@
-tests/cases/conformance/salsa/bug26885.js(2,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
tests/cases/conformance/salsa/bug26885.js(11,16): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
No index signature with a parameter of type 'string' was found on type '{}'.
-==== tests/cases/conformance/salsa/bug26885.js (2 errors) ====
+==== tests/cases/conformance/salsa/bug26885.js (1 errors) ====
function Multimap3() {
this._map = {};
- ~~~~
-!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
};
Multimap3.prototype = {
diff --git a/tests/baselines/reference/typeFromPrototypeAssignment3.symbols b/tests/baselines/reference/typeFromPrototypeAssignment3.symbols
index aec60e00543b8..5f7f20e40f598 100644
--- a/tests/baselines/reference/typeFromPrototypeAssignment3.symbols
+++ b/tests/baselines/reference/typeFromPrototypeAssignment3.symbols
@@ -3,6 +3,8 @@ function Multimap3() {
>Multimap3 : Symbol(Multimap3, Decl(bug26885.js, 0, 0), Decl(bug26885.js, 2, 2))
this._map = {};
+>this._map : Symbol(Multimap3._map, Decl(bug26885.js, 0, 22))
+>this : Symbol(Multimap3, Decl(bug26885.js, 0, 0), Decl(bug26885.js, 2, 2))
>_map : Symbol(Multimap3._map, Decl(bug26885.js, 0, 22))
};
diff --git a/tests/baselines/reference/typeFromPrototypeAssignment3.types b/tests/baselines/reference/typeFromPrototypeAssignment3.types
index 73eccd5390613..ef156d50a2c7c 100644
--- a/tests/baselines/reference/typeFromPrototypeAssignment3.types
+++ b/tests/baselines/reference/typeFromPrototypeAssignment3.types
@@ -5,7 +5,7 @@ function Multimap3() {
this._map = {};
>this._map = {} : {}
>this._map : any
->this : any
+>this : this
>_map : any
>{} : {}
diff --git a/tests/baselines/reference/typeFromPrototypeAssignment4.symbols b/tests/baselines/reference/typeFromPrototypeAssignment4.symbols
index bc7e816cc941c..b0421eff78253 100644
--- a/tests/baselines/reference/typeFromPrototypeAssignment4.symbols
+++ b/tests/baselines/reference/typeFromPrototypeAssignment4.symbols
@@ -3,6 +3,8 @@ function Multimap4() {
>Multimap4 : Symbol(Multimap4, Decl(a.js, 0, 0), Decl(a.js, 2, 2))
this._map = {};
+>this._map : Symbol(Multimap4._map, Decl(a.js, 0, 22))
+>this : Symbol(Multimap4, Decl(a.js, 0, 0), Decl(a.js, 2, 2))
>_map : Symbol(Multimap4._map, Decl(a.js, 0, 22))
};
diff --git a/tests/baselines/reference/typeFromPrototypeAssignment4.types b/tests/baselines/reference/typeFromPrototypeAssignment4.types
index 42f340ac7a956..c9b6ae04a000d 100644
--- a/tests/baselines/reference/typeFromPrototypeAssignment4.types
+++ b/tests/baselines/reference/typeFromPrototypeAssignment4.types
@@ -5,7 +5,7 @@ function Multimap4() {
this._map = {};
>this._map = {} : {}
>this._map : any
->this : any
+>this : this
>_map : any
>{} : {}
diff --git a/tests/baselines/reference/typedefCrossModule.symbols b/tests/baselines/reference/typedefCrossModule.symbols
index 6c16284a557fc..aa3c9d5784a39 100644
--- a/tests/baselines/reference/typedefCrossModule.symbols
+++ b/tests/baselines/reference/typedefCrossModule.symbols
@@ -18,6 +18,8 @@ function C() {
>C : Symbol(C, Decl(mod1.js, 4, 18))
this.p = 1
+>this.p : Symbol(C.p, Decl(mod1.js, 5, 14))
+>this : Symbol(C, Decl(mod1.js, 4, 18))
>p : Symbol(C.p, Decl(mod1.js, 5, 14))
}
@@ -31,6 +33,8 @@ export function C() {
>C : Symbol(C, Decl(mod2.js, 0, 0))
this.p = 1
+>this.p : Symbol(C.p, Decl(mod2.js, 5, 21))
+>this : Symbol(C, Decl(mod2.js, 0, 0))
>p : Symbol(C.p, Decl(mod2.js, 5, 21))
}
@@ -46,6 +50,8 @@ exports.C = function() {
>C : Symbol(C, Decl(mod3.js, 0, 0))
this.p = 1
+>this.p : Symbol(C.p, Decl(mod3.js, 5, 24))
+>this : Symbol(C, Decl(mod3.js, 5, 11))
>p : Symbol(C.p, Decl(mod3.js, 5, 24))
}
diff --git a/tests/baselines/reference/typedefCrossModule.types b/tests/baselines/reference/typedefCrossModule.types
index 052ff60fc430a..ad9de6c3115e3 100644
--- a/tests/baselines/reference/typedefCrossModule.types
+++ b/tests/baselines/reference/typedefCrossModule.types
@@ -21,7 +21,7 @@ function C() {
this.p = 1
>this.p = 1 : 1
>this.p : any
->this : any
+>this : this
>p : any
>1 : 1
}
@@ -38,7 +38,7 @@ export function C() {
this.p = 1
>this.p = 1 : 1
>this.p : any
->this : any
+>this : this
>p : any
>1 : 1
}
@@ -59,7 +59,7 @@ exports.C = function() {
this.p = 1
>this.p = 1 : 1
>this.p : any
->this : any
+>this : this
>p : any
>1 : 1
}
diff --git a/tests/cases/conformance/jsdoc/constructorTagWithThisTag.ts b/tests/cases/conformance/jsdoc/constructorTagWithThisTag.ts
new file mode 100644
index 0000000000000..0483ca0a8b439
--- /dev/null
+++ b/tests/cases/conformance/jsdoc/constructorTagWithThisTag.ts
@@ -0,0 +1,13 @@
+// @allowJs: true
+// @noEmit: true
+// @checkJs: true
+// @Filename: classthisboth.js
+
+/**
+ * @class
+ * @this {{ e: number, m: number }}
+ * this-tag should win, both 'e' and 'm' should be defined.
+ */
+function C() {
+ this.e = this.m + 1
+}
diff --git a/tests/cases/fourslash/codeFixImplicitThis_js_all.ts b/tests/cases/fourslash/codeFixImplicitThis_js_all.ts
index f99518afa1366..d442252b25423 100644
--- a/tests/cases/fourslash/codeFixImplicitThis_js_all.ts
+++ b/tests/cases/fourslash/codeFixImplicitThis_js_all.ts
@@ -5,10 +5,12 @@
// @noImplicitThis: true
// @Filename: /a.js
-////function f() {
-//// this.x = 1;
-////}
////class C {
+//// q() {
+//// function i() {
+//// this;
+//// }
+//// }
//// m() {
//// function h() {
//// this;
@@ -20,13 +22,12 @@ verify.codeFixAll({
fixId: "fixImplicitThis",
fixAllDescription: "Fix all implicit-'this' errors",
newFileContent:
-`/**
- * @class
- */
-function f() {
- this.x = 1;
-}
-class C {
+`class C {
+ q() {
+ const i = () => {
+ this;
+ }
+ }
m() {
const h = () => {
this;
diff --git a/tests/cases/fourslash/codeFixImplicitThis_js_classTag.ts b/tests/cases/fourslash/codeFixImplicitThis_js_classTag.ts
deleted file mode 100644
index 52e7930b481d7..0000000000000
--- a/tests/cases/fourslash/codeFixImplicitThis_js_classTag.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-///
-
-// @allowJs: true
-// @checkJs: true
-// @noImplicitThis: true
-
-// @Filename: /a.js
-////function f() {
-//// this.x = 1;
-////}
-
-verify.codeFix({
- description: "Add '@class' tag",
- index: 0,
- newFileContent:
-`/**
- * @class
- */
-function f() {
- this.x = 1;
-}`,
-});
diff --git a/tests/cases/fourslash/codeFixImplicitThis_js_classTag_addToComment.ts b/tests/cases/fourslash/codeFixImplicitThis_js_classTag_addToComment.ts
deleted file mode 100644
index 9b684512568b3..0000000000000
--- a/tests/cases/fourslash/codeFixImplicitThis_js_classTag_addToComment.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-///
-
-// @allowJs: true
-// @checkJs: true
-// @noImplicitThis: true
-
-// @Filename: /a.js
-/////** Doc */
-////function f() {
-//// this.x = 1;
-////}
-
-verify.codeFix({
- description: "Add '@class' tag",
- index: 0,
- newFileContent:
-`/**
- * Doc
- * @class
- */
-function f() {
- this.x = 1;
-}`,
-});