From 6c6582e913cae4802a02d70ef83f5bc2caba5c51 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 2 Apr 2018 11:12:19 -0700 Subject: [PATCH] Mark js-assignment functions' symbols as methods This make display more accurate: 1. The functions now print as methods 2. When the type of the function references the class, the type of the function itself is now printed correctly instead of as `any`. --- src/compiler/binder.ts | 6 +- src/compiler/checker.ts | 11 +- .../codefixes/convertFunctionToEs6Class.ts | 4 +- .../reference/constructorFunctions2.types | 10 +- .../constructorFunctionsStrict.types | 10 +- ...nferringClassMembersFromAssignments2.types | 2 +- .../jsContainerMergeTsDeclaration.types | 10 +- .../reference/methodsReturningThis.types | 56 +++++----- .../reference/multipleDeclarations.symbols | 6 +- .../reference/multipleDeclarations.types | 2 +- ...naturesUseJSDocForOptionalParameters.types | 30 +++--- .../reference/typeFromJSConstructor.types | 26 ++--- .../typeFromPropertyAssignment13.types | 14 +-- .../typeFromPropertyAssignment16.types | 10 +- .../typeFromPropertyAssignment20.types | 2 +- .../typeFromPropertyAssignment22.types | 12 +-- .../typeFromPropertyAssignment7.types | 8 +- .../typeFromPropertyAssignment9.types | 100 +++++++++--------- ...typeFromPropertyAssignmentWithExport.types | 8 +- .../fourslash/indirectClassInstantiation.ts | 2 +- tests/cases/fourslash/javaScriptPrototype1.ts | 4 +- tests/cases/fourslash/javaScriptPrototype3.ts | 4 +- 22 files changed, 171 insertions(+), 166 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 9ed5a687c6cf3..948cd3884b318 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -2473,8 +2473,10 @@ namespace ts { (symbol.exports || (symbol.exports = createSymbolTable())); // Declare the method/property - const symbolFlags = SymbolFlags.Property | (isToplevelNamespaceableInitializer ? SymbolFlags.JSContainer : 0); - const symbolExcludes = SymbolFlags.PropertyExcludes & ~(isToplevelNamespaceableInitializer ? SymbolFlags.JSContainer : 0); + const jsContainerFlag = isToplevelNamespaceableInitializer ? SymbolFlags.JSContainer : 0; + const isMethod = isFunctionLikeDeclaration(getAssignedJavascriptInitializer(propertyAccess)); + const symbolFlags = (isMethod ? SymbolFlags.Method : SymbolFlags.Property) | jsContainerFlag; + const symbolExcludes = (isMethod ? SymbolFlags.MethodExcludes : SymbolFlags.PropertyExcludes) & ~jsContainerFlag; declareSymbol(symbolTable, symbol, propertyAccess, symbolFlags, symbolExcludes); } diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 23abb2ce6249d..3c48319273abc 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4679,6 +4679,10 @@ namespace ts { if (symbol.flags & SymbolFlags.Module && isShorthandAmbientModuleSymbol(symbol)) { links.type = anyType; } + else if (symbol.valueDeclaration.kind === SyntaxKind.BinaryExpression || + symbol.valueDeclaration.kind === SyntaxKind.PropertyAccessExpression && symbol.valueDeclaration.parent.kind === SyntaxKind.BinaryExpression) { + links.type = getWidenedTypeFromJSSpecialPropertyDeclarations(symbol); + } else { const type = createObjectType(ObjectFlags.Anonymous, symbol); if (symbol.flags & SymbolFlags.Class) { @@ -6935,7 +6939,8 @@ namespace ts { if (!symbol) return emptyArray; const result: Signature[] = []; for (let i = 0; i < symbol.declarations.length; i++) { - const node = symbol.declarations[i]; + const decl = symbol.declarations[i]; + const node = isPropertyAccessExpression(decl) ? getAssignedJavascriptInitializer(decl) : decl; if (!isFunctionLike(node)) continue; // Don't include signature if node is the implementation of an overloaded function. A node is considered // an implementation node if it has a body and the previous node is of the same kind and immediately @@ -16221,9 +16226,7 @@ namespace ts { } function isMethodLike(symbol: Symbol) { - return !!(symbol.flags & SymbolFlags.Method || - getCheckFlags(symbol) & CheckFlags.SyntheticMethod || - isInJavaScriptFile(symbol.valueDeclaration) && isFunctionLikeDeclaration(getAssignedJavascriptInitializer(symbol.valueDeclaration))); + return !!(symbol.flags & SymbolFlags.Method || getCheckFlags(symbol) & CheckFlags.SyntheticMethod); } /** diff --git a/src/services/codefixes/convertFunctionToEs6Class.ts b/src/services/codefixes/convertFunctionToEs6Class.ts index a4386ab07f149..bb260463831d6 100644 --- a/src/services/codefixes/convertFunctionToEs6Class.ts +++ b/src/services/codefixes/convertFunctionToEs6Class.ts @@ -99,8 +99,8 @@ namespace ts.codefix { } function createClassElement(symbol: Symbol, modifiers: Modifier[]): ClassElement { - // both properties and methods are bound as property symbols - if (!(symbol.flags & SymbolFlags.Property)) { + // Right now the only thing we can convert are function expressions, which are marked as methods + if (!(symbol.flags & SymbolFlags.Method)) { return; } diff --git a/tests/baselines/reference/constructorFunctions2.types b/tests/baselines/reference/constructorFunctions2.types index 1575b35610416..e59a15f7ac98e 100644 --- a/tests/baselines/reference/constructorFunctions2.types +++ b/tests/baselines/reference/constructorFunctions2.types @@ -40,23 +40,23 @@ B.prototype.m = function() { this.x = 2; } >function() { this.x = 2; } : () => void >this.x = 2 : 2 >this.x : number ->this : { id: number; m: () => void; x: number; } +>this : { id: number; m(): void; x: number; } >x : number >2 : 2 const b = new B(); ->b : { id: number; m: () => void; x: number; } ->new B() : { id: number; m: () => void; x: number; } +>b : { id: number; m(): void; x: number; } +>new B() : { id: number; m(): void; x: number; } >B : () => void b.id; >b.id : number ->b : { id: number; m: () => void; x: number; } +>b : { id: number; m(): void; x: number; } >id : number b.x; >b.x : number ->b : { id: number; m: () => void; x: number; } +>b : { id: number; m(): void; x: number; } >x : number === tests/cases/conformance/salsa/other.js === diff --git a/tests/baselines/reference/constructorFunctionsStrict.types b/tests/baselines/reference/constructorFunctionsStrict.types index 745d55c5bfb9c..c08164f3a7145 100644 --- a/tests/baselines/reference/constructorFunctionsStrict.types +++ b/tests/baselines/reference/constructorFunctionsStrict.types @@ -23,27 +23,27 @@ C.prototype.m = function() { this.y = 12 >this.y = 12 : 12 >this.y : number | undefined ->this : { x: number; m: () => void; y: number | undefined; } +>this : { x: number; m(): void; y: number | undefined; } >y : number | undefined >12 : 12 } var c = new C(1) ->c : { x: number; m: () => void; y: number | undefined; } ->new C(1) : { x: number; m: () => void; y: number | undefined; } +>c : { x: number; m(): void; y: number | undefined; } +>new C(1) : { x: number; m(): void; y: number | undefined; } >C : (x: number) => void >1 : 1 c.x = undefined // should error >c.x = undefined : undefined >c.x : number ->c : { x: number; m: () => void; y: number | undefined; } +>c : { x: number; m(): void; y: number | undefined; } >x : number >undefined : undefined c.y = undefined // ok >c.y = undefined : undefined >c.y : number | undefined ->c : { x: number; m: () => void; y: number | undefined; } +>c : { x: number; m(): void; y: number | undefined; } >y : number | undefined >undefined : undefined diff --git a/tests/baselines/reference/inferringClassMembersFromAssignments2.types b/tests/baselines/reference/inferringClassMembersFromAssignments2.types index 8af847de9e690..17893cbf6906a 100644 --- a/tests/baselines/reference/inferringClassMembersFromAssignments2.types +++ b/tests/baselines/reference/inferringClassMembersFromAssignments2.types @@ -11,7 +11,7 @@ OOOrder.prototype.m = function () { this.p = 1 >this.p = 1 : 1 >this.p : number ->this : { x: number; m: () => void; p: number; } +>this : { x: number; m(): void; p: number; } >p : number >1 : 1 } diff --git a/tests/baselines/reference/jsContainerMergeTsDeclaration.types b/tests/baselines/reference/jsContainerMergeTsDeclaration.types index 7d5631769988d..11639a9e6897b 100644 --- a/tests/baselines/reference/jsContainerMergeTsDeclaration.types +++ b/tests/baselines/reference/jsContainerMergeTsDeclaration.types @@ -1,20 +1,20 @@ === tests/cases/conformance/salsa/a.js === var /*1*/x = function foo() { ->x : { (): void; a: () => void; } ->function foo() {} : { (): void; a: () => void; } ->foo : { (): void; a: () => void; } +>x : { (): void; a(): void; } +>function foo() {} : { (): void; a(): void; } +>foo : { (): void; a(): void; } } x.a = function bar() { >x.a = function bar() {} : () => void >x.a : () => void ->x : { (): void; a: () => void; } +>x : { (): void; a(): void; } >a : () => void >function bar() {} : () => void >bar : () => void } === tests/cases/conformance/salsa/b.ts === var x = function () { ->x : { (): void; a: () => void; } +>x : { (): void; a(): void; } >function () { return 1;}() : number >function () { return 1;} : () => number diff --git a/tests/baselines/reference/methodsReturningThis.types b/tests/baselines/reference/methodsReturningThis.types index 5bcaa992a71b7..3c670ff58e343 100644 --- a/tests/baselines/reference/methodsReturningThis.types +++ b/tests/baselines/reference/methodsReturningThis.types @@ -14,80 +14,80 @@ Class.prototype.containsError = function () { return this.notPresent; }; >containsError : any >function () { return this.notPresent; } : () => any >this.notPresent : any ->this : { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; } +>this : { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } >notPresent : any // lots of methods that return this, which caused out-of-memory in #9527 Class.prototype.m1 = function (a, b, c, d, tx, ty) { return this; }; ->Class.prototype.m1 = function (a, b, c, d, tx, ty) { return this; } : (a: any, b: any, c: any, d: any, tx: any, ty: any) => { containsError: () => any; m1: any; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; } +>Class.prototype.m1 = function (a, b, c, d, tx, ty) { return this; } : (a: any, b: any, c: any, d: any, tx: any, ty: any) => { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } >Class.prototype.m1 : any >Class.prototype : any >Class : () => void >prototype : any >m1 : any ->function (a, b, c, d, tx, ty) { return this; } : (a: any, b: any, c: any, d: any, tx: any, ty: any) => { containsError: () => any; m1: any; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; } +>function (a, b, c, d, tx, ty) { return this; } : (a: any, b: any, c: any, d: any, tx: any, ty: any) => { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } >a : any >b : any >c : any >d : any >tx : any >ty : any ->this : { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; } +>this : { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } Class.prototype.m2 = function (x, y) { return this; }; ->Class.prototype.m2 = function (x, y) { return this; } : (x: any, y: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: any; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; } +>Class.prototype.m2 = function (x, y) { return this; } : (x: any, y: any) => { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } >Class.prototype.m2 : any >Class.prototype : any >Class : () => void >prototype : any >m2 : any ->function (x, y) { return this; } : (x: any, y: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: any; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; } +>function (x, y) { return this; } : (x: any, y: any) => { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } >x : any >y : any ->this : { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; } +>this : { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } Class.prototype.m3 = function (x, y) { return this; }; ->Class.prototype.m3 = function (x, y) { return this; } : (x: any, y: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: any; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; } +>Class.prototype.m3 = function (x, y) { return this; } : (x: any, y: any) => { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } >Class.prototype.m3 : any >Class.prototype : any >Class : () => void >prototype : any >m3 : any ->function (x, y) { return this; } : (x: any, y: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: any; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; } +>function (x, y) { return this; } : (x: any, y: any) => { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } >x : any >y : any ->this : { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; } +>this : { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } Class.prototype.m4 = function (angle) { return this; }; ->Class.prototype.m4 = function (angle) { return this; } : (angle: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: any; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; } +>Class.prototype.m4 = function (angle) { return this; } : (angle: any) => { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } >Class.prototype.m4 : any >Class.prototype : any >Class : () => void >prototype : any >m4 : any ->function (angle) { return this; } : (angle: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: any; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; } +>function (angle) { return this; } : (angle: any) => { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } >angle : any ->this : { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; } +>this : { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } Class.prototype.m5 = function (matrix) { return this; }; ->Class.prototype.m5 = function (matrix) { return this; } : (matrix: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: any; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; } +>Class.prototype.m5 = function (matrix) { return this; } : (matrix: any) => { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } >Class.prototype.m5 : any >Class.prototype : any >Class : () => void >prototype : any >m5 : any ->function (matrix) { return this; } : (matrix: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: any; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; } +>function (matrix) { return this; } : (matrix: any) => { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } >matrix : any ->this : { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; } +>this : { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } Class.prototype.m6 = function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { return this; }; ->Class.prototype.m6 = function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { return this; } : (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: any; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; } +>Class.prototype.m6 = function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { return this; } : (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } >Class.prototype.m6 : any >Class.prototype : any >Class : () => void >prototype : any >m6 : any ->function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { return this; } : (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: any; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; } +>function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { return this; } : (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } >x : any >y : any >pivotX : any @@ -97,37 +97,37 @@ Class.prototype.m6 = function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, s >rotation : any >skewX : any >skewY : any ->this : { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; } +>this : { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } Class.prototype.m7 = function(matrix) { return this; }; ->Class.prototype.m7 = function(matrix) { return this; } : (matrix: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: any; m8: () => typeof Class; m9: () => typeof Class; } +>Class.prototype.m7 = function(matrix) { return this; } : (matrix: any) => { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } >Class.prototype.m7 : any >Class.prototype : any >Class : () => void >prototype : any >m7 : any ->function(matrix) { return this; } : (matrix: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: any; m8: () => typeof Class; m9: () => typeof Class; } +>function(matrix) { return this; } : (matrix: any) => { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } >matrix : any ->this : { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; } +>this : { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } Class.prototype.m8 = function() { return this; }; ->Class.prototype.m8 = function() { return this; } : () => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: any; m9: () => typeof Class; } +>Class.prototype.m8 = function() { return this; } : () => { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } >Class.prototype.m8 : any >Class.prototype : any >Class : () => void >prototype : any >m8 : any ->function() { return this; } : () => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: any; m9: () => typeof Class; } ->this : { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; } +>function() { return this; } : () => { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } +>this : { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } Class.prototype.m9 = function () { return this; }; ->Class.prototype.m9 = function () { return this; } : () => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: any; } +>Class.prototype.m9 = function () { return this; } : () => { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } >Class.prototype.m9 : any >Class.prototype : any >Class : () => void >prototype : any >m9 : any ->function () { return this; } : () => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: any; } ->this : { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; } +>function () { return this; } : () => { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } +>this : { containsError(): any; m1(a: any, b: any, c: any, d: any, tx: any, ty: any): typeof Class; m2(x: any, y: any): typeof Class; m3(x: any, y: any): typeof Class; m4(angle: any): typeof Class; m5(matrix: any): typeof Class; m6(x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any): typeof Class; m7(matrix: any): typeof Class; m8(): typeof Class; m9(): typeof Class; } diff --git a/tests/baselines/reference/multipleDeclarations.symbols b/tests/baselines/reference/multipleDeclarations.symbols index 3133d77056baa..930dd402da684 100644 --- a/tests/baselines/reference/multipleDeclarations.symbols +++ b/tests/baselines/reference/multipleDeclarations.symbols @@ -3,13 +3,13 @@ function C() { >C : Symbol(C, Decl(input.js, 0, 0)) this.m = null; ->m : Symbol(C.m, Decl(input.js, 0, 14), Decl(input.js, 2, 1)) +>m : Symbol(C.m, Decl(input.js, 0, 14)) } C.prototype.m = function() { ->C.prototype : Symbol(C.m, Decl(input.js, 0, 14), Decl(input.js, 2, 1)) +>C.prototype : Symbol(C.m, Decl(input.js, 2, 1)) >C : Symbol(C, Decl(input.js, 0, 0)) >prototype : Symbol(Function.prototype, Decl(lib.d.ts, --, --)) ->m : Symbol(C.m, Decl(input.js, 0, 14), Decl(input.js, 2, 1)) +>m : Symbol(C.m, Decl(input.js, 2, 1)) this.nothing(); >this : Symbol(C, Decl(input.js, 0, 0)) diff --git a/tests/baselines/reference/multipleDeclarations.types b/tests/baselines/reference/multipleDeclarations.types index 740effe03dd34..dcddde3e8a15d 100644 --- a/tests/baselines/reference/multipleDeclarations.types +++ b/tests/baselines/reference/multipleDeclarations.types @@ -21,7 +21,7 @@ C.prototype.m = function() { this.nothing(); >this.nothing() : any >this.nothing : any ->this : { m: () => void; } +>this : { m: any; } >nothing : any } class X { diff --git a/tests/baselines/reference/signaturesUseJSDocForOptionalParameters.types b/tests/baselines/reference/signaturesUseJSDocForOptionalParameters.types index 99bf5e15fa71b..f14e00d692225 100644 --- a/tests/baselines/reference/signaturesUseJSDocForOptionalParameters.types +++ b/tests/baselines/reference/signaturesUseJSDocForOptionalParameters.types @@ -15,39 +15,39 @@ function MyClass() { * @returns {MyClass} */ MyClass.prototype.optionalParam = function(required, notRequired) { ->MyClass.prototype.optionalParam = function(required, notRequired) { return this;} : (required: string, notRequired?: string) => { prop: any; optionalParam: any; } +>MyClass.prototype.optionalParam = function(required, notRequired) { return this;} : (required: string, notRequired?: string) => { prop: any; optionalParam(required: string, notRequired?: string): typeof MyClass; } >MyClass.prototype.optionalParam : any >MyClass.prototype : any >MyClass : () => void >prototype : any >optionalParam : any ->function(required, notRequired) { return this;} : (required: string, notRequired?: string) => { prop: any; optionalParam: any; } +>function(required, notRequired) { return this;} : (required: string, notRequired?: string) => { prop: any; optionalParam(required: string, notRequired?: string): typeof MyClass; } >required : string >notRequired : string return this; ->this : { prop: any; optionalParam: (required: string, notRequired?: string) => typeof MyClass; } +>this : { prop: any; optionalParam(required: string, notRequired?: string): typeof MyClass; } }; let pInst = new MyClass(); ->pInst : { prop: any; optionalParam: (required: string, notRequired?: string) => typeof MyClass; } ->new MyClass() : { prop: any; optionalParam: (required: string, notRequired?: string) => typeof MyClass; } +>pInst : { prop: any; optionalParam(required: string, notRequired?: string): typeof MyClass; } +>new MyClass() : { prop: any; optionalParam(required: string, notRequired?: string): typeof MyClass; } >MyClass : () => void let c1 = pInst.optionalParam('hello') ->c1 : { prop: any; optionalParam: (required: string, notRequired?: string) => typeof MyClass; } ->pInst.optionalParam('hello') : { prop: any; optionalParam: (required: string, notRequired?: string) => typeof MyClass; } ->pInst.optionalParam : (required: string, notRequired?: string) => { prop: any; optionalParam: any; } ->pInst : { prop: any; optionalParam: (required: string, notRequired?: string) => typeof MyClass; } ->optionalParam : (required: string, notRequired?: string) => { prop: any; optionalParam: any; } +>c1 : { prop: any; optionalParam(required: string, notRequired?: string): typeof MyClass; } +>pInst.optionalParam('hello') : { prop: any; optionalParam(required: string, notRequired?: string): typeof MyClass; } +>pInst.optionalParam : (required: string, notRequired?: string) => { prop: any; optionalParam(required: string, notRequired?: string): typeof MyClass; } +>pInst : { prop: any; optionalParam(required: string, notRequired?: string): typeof MyClass; } +>optionalParam : (required: string, notRequired?: string) => { prop: any; optionalParam(required: string, notRequired?: string): typeof MyClass; } >'hello' : "hello" let c2 = pInst.optionalParam('hello', null) ->c2 : { prop: any; optionalParam: (required: string, notRequired?: string) => typeof MyClass; } ->pInst.optionalParam('hello', null) : { prop: any; optionalParam: (required: string, notRequired?: string) => typeof MyClass; } ->pInst.optionalParam : (required: string, notRequired?: string) => { prop: any; optionalParam: any; } ->pInst : { prop: any; optionalParam: (required: string, notRequired?: string) => typeof MyClass; } ->optionalParam : (required: string, notRequired?: string) => { prop: any; optionalParam: any; } +>c2 : { prop: any; optionalParam(required: string, notRequired?: string): typeof MyClass; } +>pInst.optionalParam('hello', null) : { prop: any; optionalParam(required: string, notRequired?: string): typeof MyClass; } +>pInst.optionalParam : (required: string, notRequired?: string) => { prop: any; optionalParam(required: string, notRequired?: string): typeof MyClass; } +>pInst : { prop: any; optionalParam(required: string, notRequired?: string): typeof MyClass; } +>optionalParam : (required: string, notRequired?: string) => { prop: any; optionalParam(required: string, notRequired?: string): typeof MyClass; } >'hello' : "hello" >null : null diff --git a/tests/baselines/reference/typeFromJSConstructor.types b/tests/baselines/reference/typeFromJSConstructor.types index f7dd925ed5cbe..78890dde7552b 100644 --- a/tests/baselines/reference/typeFromJSConstructor.types +++ b/tests/baselines/reference/typeFromJSConstructor.types @@ -60,35 +60,35 @@ Installer.prototype.first = function () { this.arg = 'hi' // error >this.arg = 'hi' : "hi" >this.arg : number ->this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first: () => void; newProperty: number | boolean | undefined; second: () => void; } +>this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first(): void; newProperty: number | boolean | undefined; second(): void; } >arg : number >'hi' : "hi" this.unknown = 'hi' // ok >this.unknown = 'hi' : "hi" >this.unknown : string | boolean | null ->this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first: () => void; newProperty: number | boolean | undefined; second: () => void; } +>this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first(): void; newProperty: number | boolean | undefined; second(): void; } >unknown : string | boolean | null >'hi' : "hi" this.newProperty = 1 // ok: number | boolean >this.newProperty = 1 : 1 >this.newProperty : number | boolean | undefined ->this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first: () => void; newProperty: number | boolean | undefined; second: () => void; } +>this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first(): void; newProperty: number | boolean | undefined; second(): void; } >newProperty : number | boolean | undefined >1 : 1 this.twice = undefined // ok >this.twice = undefined : undefined >this.twice : string | undefined ->this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first: () => void; newProperty: number | boolean | undefined; second: () => void; } +>this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first(): void; newProperty: number | boolean | undefined; second(): void; } >twice : string | undefined >undefined : undefined this.twice = 'hi' // ok >this.twice = 'hi' : "hi" >this.twice : string | undefined ->this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first: () => void; newProperty: number | boolean | undefined; second: () => void; } +>this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first(): void; newProperty: number | boolean | undefined; second(): void; } >twice : string | undefined >'hi' : "hi" } @@ -104,35 +104,35 @@ Installer.prototype.second = function () { this.arg = false // error >this.arg = false : false >this.arg : number ->this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first: () => void; newProperty: number | boolean | undefined; second: () => void; } +>this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first(): void; newProperty: number | boolean | undefined; second(): void; } >arg : number >false : false this.unknown = false // ok >this.unknown = false : false >this.unknown : string | boolean | null ->this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first: () => void; newProperty: number | boolean | undefined; second: () => void; } +>this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first(): void; newProperty: number | boolean | undefined; second(): void; } >unknown : string | boolean | null >false : false this.newProperty = false // ok >this.newProperty = false : false >this.newProperty : number | boolean | undefined ->this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first: () => void; newProperty: number | boolean | undefined; second: () => void; } +>this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first(): void; newProperty: number | boolean | undefined; second(): void; } >newProperty : number | boolean | undefined >false : false this.twice = null // error >this.twice = null : null >this.twice : string | undefined ->this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first: () => void; newProperty: number | boolean | undefined; second: () => void; } +>this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first(): void; newProperty: number | boolean | undefined; second(): void; } >twice : string | undefined >null : null this.twice = false // error >this.twice = false : false >this.twice : string | undefined ->this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first: () => void; newProperty: number | boolean | undefined; second: () => void; } +>this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first(): void; newProperty: number | boolean | undefined; second(): void; } >twice : string | undefined >false : false @@ -140,7 +140,7 @@ Installer.prototype.second = function () { >this.twices.push(1) : number >this.twices.push : (...items: any[]) => number >this.twices : any[] | null ->this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first: () => void; newProperty: number | boolean | undefined; second: () => void; } +>this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first(): void; newProperty: number | boolean | undefined; second(): void; } >twices : any[] | null >push : (...items: any[]) => number >1 : 1 @@ -148,7 +148,7 @@ Installer.prototype.second = function () { if (this.twices != null) { >this.twices != null : boolean >this.twices : any[] | null ->this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first: () => void; newProperty: number | boolean | undefined; second: () => void; } +>this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first(): void; newProperty: number | boolean | undefined; second(): void; } >twices : any[] | null >null : null @@ -156,7 +156,7 @@ Installer.prototype.second = function () { >this.twices.push('hi') : number >this.twices.push : (...items: any[]) => number >this.twices : any[] ->this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first: () => void; newProperty: number | boolean | undefined; second: () => void; } +>this : { arg: number; unknown: string | boolean | null; twice: string | undefined; twices: any[] | null; first(): void; newProperty: number | boolean | undefined; second(): void; } >twices : any[] >push : (...items: any[]) => number >'hi' : "hi" diff --git a/tests/baselines/reference/typeFromPropertyAssignment13.types b/tests/baselines/reference/typeFromPropertyAssignment13.types index ef0caf5c849c5..a1c28a8e9f8b7 100644 --- a/tests/baselines/reference/typeFromPropertyAssignment13.types +++ b/tests/baselines/reference/typeFromPropertyAssignment13.types @@ -1,12 +1,12 @@ === tests/cases/conformance/salsa/module.js === var Outer = {} ->Outer : { [x: string]: any; Inner: () => void; } ->{} : { [x: string]: any; Inner: () => void; } +>Outer : { [x: string]: any; Inner(): void; } +>{} : { [x: string]: any; Inner(): void; } Outer.Inner = function() {} >Outer.Inner = function() {} : () => void >Outer.Inner : () => void ->Outer : { [x: string]: any; Inner: () => void; } +>Outer : { [x: string]: any; Inner(): void; } >Inner : () => void >function() {} : () => void @@ -14,7 +14,7 @@ Outer.Inner.prototype = { >Outer.Inner.prototype = { m() { }, i: 1} : { [x: string]: any; m(): void; i: number; } >Outer.Inner.prototype : any >Outer.Inner : () => void ->Outer : { [x: string]: any; Inner: () => void; } +>Outer : { [x: string]: any; Inner(): void; } >Inner : () => void >prototype : any >{ m() { }, i: 1} : { [x: string]: any; m(): void; i: number; } @@ -32,7 +32,7 @@ Outer.Inner.prototype.j = 2 >Outer.Inner.prototype.j : any >Outer.Inner.prototype : any >Outer.Inner : () => void ->Outer : { [x: string]: any; Inner: () => void; } +>Outer : { [x: string]: any; Inner(): void; } >Inner : () => void >prototype : any >j : any @@ -43,7 +43,7 @@ Outer.Inner.prototype.k; >Outer.Inner.prototype.k : any >Outer.Inner.prototype : any >Outer.Inner : () => void ->Outer : { [x: string]: any; Inner: () => void; } +>Outer : { [x: string]: any; Inner(): void; } >Inner : () => void >prototype : any >k : any @@ -52,7 +52,7 @@ var inner = new Outer.Inner() >inner : { j: number; k: string; } & { [x: string]: any; m(): void; i: number; } >new Outer.Inner() : { j: number; k: string; } & { [x: string]: any; m(): void; i: number; } >Outer.Inner : () => void ->Outer : { [x: string]: any; Inner: () => void; } +>Outer : { [x: string]: any; Inner(): void; } >Inner : () => void inner.m() diff --git a/tests/baselines/reference/typeFromPropertyAssignment16.types b/tests/baselines/reference/typeFromPropertyAssignment16.types index a1167f3da6e8a..95fc42ca43445 100644 --- a/tests/baselines/reference/typeFromPropertyAssignment16.types +++ b/tests/baselines/reference/typeFromPropertyAssignment16.types @@ -1,12 +1,12 @@ === tests/cases/conformance/salsa/a.js === var Outer = {}; ->Outer : { [x: string]: any; Inner: () => void; } ->{} : { [x: string]: any; Inner: () => void; } +>Outer : { [x: string]: any; Inner(): void; } +>{} : { [x: string]: any; Inner(): void; } Outer.Inner = function () {} >Outer.Inner = function () {} : () => void >Outer.Inner : () => void ->Outer : { [x: string]: any; Inner: () => void; } +>Outer : { [x: string]: any; Inner(): void; } >Inner : () => void >function () {} : () => void @@ -14,7 +14,7 @@ Outer.Inner.prototype = { >Outer.Inner.prototype = { x: 1, m() { }} : { [x: string]: any; x: number; m(): void; } >Outer.Inner.prototype : any >Outer.Inner : () => void ->Outer : { [x: string]: any; Inner: () => void; } +>Outer : { [x: string]: any; Inner(): void; } >Inner : () => void >prototype : any >{ x: 1, m() { }} : { [x: string]: any; x: number; m(): void; } @@ -46,7 +46,7 @@ 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 ->Outer : { [x: string]: any; Inner: () => void; } +>Outer : { [x: string]: any; Inner(): void; } >Inner : () => void inno.x diff --git a/tests/baselines/reference/typeFromPropertyAssignment20.types b/tests/baselines/reference/typeFromPropertyAssignment20.types index 85265a97c84e2..77e7ac2bb9e90 100644 --- a/tests/baselines/reference/typeFromPropertyAssignment20.types +++ b/tests/baselines/reference/typeFromPropertyAssignment20.types @@ -39,7 +39,7 @@ this._trampolineEnabled = false; >this._trampolineEnabled = false : false >this._trampolineEnabled : boolean ->this : { _trampolineEnabled: boolean; disableTrampolineIfNecessary: (b: any) => void; } +>this : { _trampolineEnabled: boolean; disableTrampolineIfNecessary(b: any): void; } >_trampolineEnabled : boolean >false : false } diff --git a/tests/baselines/reference/typeFromPropertyAssignment22.types b/tests/baselines/reference/typeFromPropertyAssignment22.types index 56b1f8c916988..03a4cd3ea073d 100644 --- a/tests/baselines/reference/typeFromPropertyAssignment22.types +++ b/tests/baselines/reference/typeFromPropertyAssignment22.types @@ -27,29 +27,29 @@ Installer.prototype.loadArgMetadata = function (next) { this.args = 'hi' >this.args = 'hi' : "hi" >this.args : number ->this : { args: number; loadArgMetadata: (next: any) => void; newProperty: number | undefined; } +>this : { args: number; loadArgMetadata(next: any): void; newProperty: number | undefined; } >args : number >'hi' : "hi" this.newProperty = 1 >this.newProperty = 1 : 1 >this.newProperty : number | undefined ->this : { args: number; loadArgMetadata: (next: any) => void; newProperty: number | undefined; } +>this : { args: number; loadArgMetadata(next: any): void; newProperty: number | undefined; } >newProperty : number | undefined >1 : 1 } } var i = new Installer() ->i : { args: number; loadArgMetadata: (next: any) => void; newProperty: number | undefined; } ->new Installer() : { args: number; loadArgMetadata: (next: any) => void; newProperty: number | undefined; } +>i : { args: number; loadArgMetadata(next: any): void; newProperty: number | undefined; } +>new Installer() : { args: number; loadArgMetadata(next: any): void; newProperty: number | undefined; } >Installer : () => void i.newProperty = i.args // ok, number ==> number | undefined >i.newProperty = i.args : number >i.newProperty : number | undefined ->i : { args: number; loadArgMetadata: (next: any) => void; newProperty: number | undefined; } +>i : { args: number; loadArgMetadata(next: any): void; newProperty: number | undefined; } >newProperty : number | undefined >i.args : number ->i : { args: number; loadArgMetadata: (next: any) => void; newProperty: number | undefined; } +>i : { args: number; loadArgMetadata(next: any): void; newProperty: number | undefined; } >args : number diff --git a/tests/baselines/reference/typeFromPropertyAssignment7.types b/tests/baselines/reference/typeFromPropertyAssignment7.types index d53c5eb1a2acb..c17abf3216398 100644 --- a/tests/baselines/reference/typeFromPropertyAssignment7.types +++ b/tests/baselines/reference/typeFromPropertyAssignment7.types @@ -1,12 +1,12 @@ === tests/cases/conformance/salsa/a.js === var obj = {}; ->obj : { [x: string]: any; method: (hunch: any) => boolean; } ->{} : { [x: string]: any; method: (hunch: any) => boolean; } +>obj : { [x: string]: any; method(hunch: any): boolean; } +>{} : { [x: string]: any; method(hunch: any): boolean; } obj.method = function (hunch) { >obj.method = function (hunch) { return true;} : (hunch: any) => boolean >obj.method : (hunch: any) => boolean ->obj : { [x: string]: any; method: (hunch: any) => boolean; } +>obj : { [x: string]: any; method(hunch: any): boolean; } >method : (hunch: any) => boolean >function (hunch) { return true;} : (hunch: any) => boolean >hunch : any @@ -18,6 +18,6 @@ var b = obj.method(); >b : boolean >obj.method() : boolean >obj.method : (hunch: any) => boolean ->obj : { [x: string]: any; method: (hunch: any) => boolean; } +>obj : { [x: string]: any; method(hunch: any): boolean; } >method : (hunch: any) => boolean diff --git a/tests/baselines/reference/typeFromPropertyAssignment9.types b/tests/baselines/reference/typeFromPropertyAssignment9.types index bd1740fa6e118..3e233be7a7cf1 100644 --- a/tests/baselines/reference/typeFromPropertyAssignment9.types +++ b/tests/baselines/reference/typeFromPropertyAssignment9.types @@ -1,15 +1,15 @@ === tests/cases/conformance/salsa/a.js === var my = my || {}; ->my : { [x: string]: any; method: (n: number) => number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); }; } ->my || {} : { [x: string]: any; method: (n: number) => number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); }; } ->my : { [x: string]: any; method: (n: number) => number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); }; } ->{} : { [x: string]: any; method: (n: number) => number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); }; } +>my : { [x: string]: any; method(n: number): number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); }; } +>my || {} : { [x: string]: any; method(n: number): number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); }; } +>my : { [x: string]: any; method(n: number): number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); }; } +>{} : { [x: string]: any; method(n: number): number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); }; } /** @param {number} n */ my.method = function(n) { >my.method = function(n) { return n + 1;} : (n: number) => number >my.method : (n: number) => number ->my : { [x: string]: any; method: (n: number) => number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); }; } +>my : { [x: string]: any; method(n: number): number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); }; } >method : (n: number) => number >function(n) { return n + 1;} : (n: number) => number >n : number @@ -22,45 +22,45 @@ my.method = function(n) { my.number = 1; >my.number = 1 : 1 >my.number : number ->my : { [x: string]: any; method: (n: number) => number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); }; } +>my : { [x: string]: any; method(n: number): number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); }; } >number : number >1 : 1 my.object = {}; >my.object = {} : { [x: string]: any; } >my.object : { [x: string]: any; } ->my : { [x: string]: any; method: (n: number) => number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); }; } +>my : { [x: string]: any; method(n: number): number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); }; } >object : { [x: string]: any; } >{} : { [x: string]: any; } my.predicate = my.predicate || {}; ->my.predicate = my.predicate || {} : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } ->my.predicate : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } ->my : { [x: string]: any; method: (n: number) => number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); }; } ->predicate : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } ->my.predicate || {} : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } ->my.predicate : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } ->my : { [x: string]: any; method: (n: number) => number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); }; } ->predicate : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } ->{} : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } +>my.predicate = my.predicate || {} : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } +>my.predicate : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } +>my : { [x: string]: any; method(n: number): number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); }; } +>predicate : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } +>my.predicate || {} : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } +>my.predicate : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } +>my : { [x: string]: any; method(n: number): number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); }; } +>predicate : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } +>{} : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } my.predicate.query = function () { ->my.predicate.query = function () { var me = this; me.property = false;} : { (): void; another: () => number; result: string; } ->my.predicate.query : { (): void; another: () => number; result: string; } ->my.predicate : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } ->my : { [x: string]: any; method: (n: number) => number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); }; } ->predicate : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } ->query : { (): void; another: () => number; result: string; } ->function () { var me = this; me.property = false;} : { (): void; another: () => number; result: string; } +>my.predicate.query = function () { var me = this; me.property = false;} : { (): void; another(): number; result: string; } +>my.predicate.query : { (): void; another(): number; result: string; } +>my.predicate : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } +>my : { [x: string]: any; method(n: number): number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); }; } +>predicate : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } +>query : { (): void; another(): number; result: string; } +>function () { var me = this; me.property = false;} : { (): void; another(): number; result: string; } var me = this; ->me : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } ->this : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } +>me : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } +>this : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } me.property = false; >me.property = false : false >me.property : any ->me : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } +>me : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } >property : any >false : false @@ -68,20 +68,20 @@ my.predicate.query = function () { var q = new my.predicate.query(); >q : any >new my.predicate.query() : any ->my.predicate.query : { (): void; another: () => number; result: string; } ->my.predicate : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } ->my : { [x: string]: any; method: (n: number) => number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); }; } ->predicate : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } ->query : { (): void; another: () => number; result: string; } +>my.predicate.query : { (): void; another(): number; result: string; } +>my.predicate : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } +>my : { [x: string]: any; method(n: number): number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); }; } +>predicate : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } +>query : { (): void; another(): number; result: string; } my.predicate.query.another = function () { >my.predicate.query.another = function () { return 1;} : () => number >my.predicate.query.another : () => number ->my.predicate.query : { (): void; another: () => number; result: string; } ->my.predicate : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } ->my : { [x: string]: any; method: (n: number) => number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); }; } ->predicate : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } ->query : { (): void; another: () => number; result: string; } +>my.predicate.query : { (): void; another(): number; result: string; } +>my.predicate : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } +>my : { [x: string]: any; method(n: number): number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); }; } +>predicate : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } +>query : { (): void; another(): number; result: string; } >another : () => number >function () { return 1;} : () => number @@ -91,11 +91,11 @@ my.predicate.query.another = function () { my.predicate.query.result = 'none' >my.predicate.query.result = 'none' : "none" >my.predicate.query.result : string ->my.predicate.query : { (): void; another: () => number; result: string; } ->my.predicate : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } ->my : { [x: string]: any; method: (n: number) => number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); }; } ->predicate : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } ->query : { (): void; another: () => number; result: string; } +>my.predicate.query : { (): void; another(): number; result: string; } +>my.predicate : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } +>my : { [x: string]: any; method(n: number): number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); }; } +>predicate : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } +>query : { (): void; another(): number; result: string; } >result : string >'none' : "none" @@ -105,15 +105,15 @@ my.predicate.query.result = 'none' my.predicate.sort = my.predicate.sort || function (first, second) { >my.predicate.sort = my.predicate.sort || function (first, second) { return first > second ? first : second;} : (first: number, second: number) => number >my.predicate.sort : (first: number, second: number) => number ->my.predicate : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } ->my : { [x: string]: any; method: (n: number) => number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); }; } ->predicate : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } +>my.predicate : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } +>my : { [x: string]: any; method(n: number): number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); }; } +>predicate : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } >sort : (first: number, second: number) => number >my.predicate.sort || function (first, second) { return first > second ? first : second;} : (first: number, second: number) => number >my.predicate.sort : (first: number, second: number) => number ->my.predicate : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } ->my : { [x: string]: any; method: (n: number) => number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); }; } ->predicate : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } +>my.predicate : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } +>my : { [x: string]: any; method(n: number): number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); }; } +>predicate : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } >sort : (first: number, second: number) => number >function (first, second) { return first > second ? first : second;} : (first: number, second: number) => number >first : number @@ -130,9 +130,9 @@ my.predicate.sort = my.predicate.sort || function (first, second) { my.predicate.type = class { >my.predicate.type = class { m() { return 101; }} : typeof (Anonymous class) >my.predicate.type : typeof (Anonymous class) ->my.predicate : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } ->my : { [x: string]: any; method: (n: number) => number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); }; } ->predicate : { [x: string]: any; query: { (): void; another: () => number; result: string; }; sort: (first: number, second: number) => number; type: typeof (Anonymous class); } +>my.predicate : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } +>my : { [x: string]: any; method(n: number): number; number: number; object: { [x: string]: any; }; predicate: { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); }; } +>predicate : { [x: string]: any; query: { (): void; another(): number; result: string; }; sort(first: number, second: number): number; type: typeof (Anonymous class); } >type : typeof (Anonymous class) >class { m() { return 101; }} : typeof (Anonymous class) diff --git a/tests/baselines/reference/typeFromPropertyAssignmentWithExport.types b/tests/baselines/reference/typeFromPropertyAssignmentWithExport.types index a7c3979c3295d..5329632527436 100644 --- a/tests/baselines/reference/typeFromPropertyAssignmentWithExport.types +++ b/tests/baselines/reference/typeFromPropertyAssignmentWithExport.types @@ -2,13 +2,13 @@ // this is a javascript file... export const Adapter = {}; ->Adapter : { [x: string]: any; prop: { [x: string]: any; }; asyncMethod: () => void; } ->{} : { [x: string]: any; prop: { [x: string]: any; }; asyncMethod: () => void; } +>Adapter : { [x: string]: any; prop: { [x: string]: any; }; asyncMethod(): void; } +>{} : { [x: string]: any; prop: { [x: string]: any; }; asyncMethod(): void; } Adapter.prop = {}; >Adapter.prop = {} : { [x: string]: any; } >Adapter.prop : { [x: string]: any; } ->Adapter : { [x: string]: any; prop: { [x: string]: any; }; asyncMethod: () => void; } +>Adapter : { [x: string]: any; prop: { [x: string]: any; }; asyncMethod(): void; } >prop : { [x: string]: any; } >{} : { [x: string]: any; } @@ -16,7 +16,7 @@ Adapter.prop = {}; Adapter.asyncMethod = function() {} >Adapter.asyncMethod = function() {} : () => void >Adapter.asyncMethod : () => void ->Adapter : { [x: string]: any; prop: { [x: string]: any; }; asyncMethod: () => void; } +>Adapter : { [x: string]: any; prop: { [x: string]: any; }; asyncMethod(): void; } >asyncMethod : () => void >function() {} : () => void diff --git a/tests/cases/fourslash/indirectClassInstantiation.ts b/tests/cases/fourslash/indirectClassInstantiation.ts index c4d0d38d6ed94..819db3373082f 100644 --- a/tests/cases/fourslash/indirectClassInstantiation.ts +++ b/tests/cases/fourslash/indirectClassInstantiation.ts @@ -18,4 +18,4 @@ verify.completionListContains('property'); edit.backspace(); goTo.marker('b'); -verify.quickInfoIs('(property) class2.blah: () => void'); +verify.quickInfoIs('(method) class2.blah(): void'); diff --git a/tests/cases/fourslash/javaScriptPrototype1.ts b/tests/cases/fourslash/javaScriptPrototype1.ts index 8b2d6f3fb84b1..7eae28f9e983c 100644 --- a/tests/cases/fourslash/javaScriptPrototype1.ts +++ b/tests/cases/fourslash/javaScriptPrototype1.ts @@ -22,8 +22,8 @@ // Members of the class instance goTo.marker('1'); edit.insert('.'); -verify.completionListContains('foo', undefined, undefined, 'property'); -verify.completionListContains('bar', undefined, undefined, 'property'); +verify.completionListContains('foo', undefined, undefined, 'method'); +verify.completionListContains('bar', undefined, undefined, 'method'); edit.backspace(); // Members of a class method (1) diff --git a/tests/cases/fourslash/javaScriptPrototype3.ts b/tests/cases/fourslash/javaScriptPrototype3.ts index 7b3f63eca57f1..4a92f4226b99c 100644 --- a/tests/cases/fourslash/javaScriptPrototype3.ts +++ b/tests/cases/fourslash/javaScriptPrototype3.ts @@ -15,6 +15,6 @@ goTo.marker(); edit.insert('.'); // Check members of the function -verify.completionListContains('foo', undefined, undefined, 'property'); -verify.completionListContains('bar', undefined, undefined, 'property'); +verify.completionListContains('foo', undefined, undefined, 'method'); +verify.completionListContains('bar', undefined, undefined, 'method'); verify.completionListContains('qua', undefined, undefined, 'property');