From 755ba737dac9e8553267ffa0ccf3c563200155e9 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 29 Apr 2016 10:37:45 -0700 Subject: [PATCH] Update looseThisTypeInFunctions baselines --- .../reference/looseThisTypeInFunctions.errors.txt | 11 ++++++----- .../baselines/reference/looseThisTypeInFunctions.js | 13 +++++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/tests/baselines/reference/looseThisTypeInFunctions.errors.txt b/tests/baselines/reference/looseThisTypeInFunctions.errors.txt index f19c918ce44..7e12a714406 100644 --- a/tests/baselines/reference/looseThisTypeInFunctions.errors.txt +++ b/tests/baselines/reference/looseThisTypeInFunctions.errors.txt @@ -33,14 +33,14 @@ tests/cases/conformance/types/thisType/looseThisTypeInFunctions.ts(46,20): error !!! error TS2322: Type '(this: C, m: number) => number' is not assignable to type '(this: void, m: number) => number'. !!! error TS2322: The 'this' types of each signature are incompatible. !!! error TS2322: Type 'void' is not assignable to type 'C'. - let o = { + let o = { n: 101, - explicitThis: function (m: number) { - return m + this.n.length; // ok, this.n: any + explicitThis: function (m: number) { + return m + this.n.length; // error, 'length' does not exist on 'number' ~~~~~~ !!! error TS2339: Property 'length' does not exist on type 'number'. }, - implicitThis(m: number): number { return m; } + implicitThis(m: number): number { return m; } }; let i: I = o; let o2: I = { @@ -66,4 +66,5 @@ tests/cases/conformance/types/thisType/looseThisTypeInFunctions.ts(46,20): error return this.n.length; // error, this.n: number ~~~~~~ !!! error TS2339: Property 'length' does not exist on type 'number'. - } \ No newline at end of file + } + \ No newline at end of file diff --git a/tests/baselines/reference/looseThisTypeInFunctions.js b/tests/baselines/reference/looseThisTypeInFunctions.js index 3b172877e0e..cb1fbcc8b95 100644 --- a/tests/baselines/reference/looseThisTypeInFunctions.js +++ b/tests/baselines/reference/looseThisTypeInFunctions.js @@ -20,12 +20,12 @@ class C implements I { } let c = new C(); c.explicitVoid = c.explicitThis; // error, 'void' is missing everything -let o = { +let o = { n: 101, - explicitThis: function (m: number) { - return m + this.n.length; // ok, this.n: any + explicitThis: function (m: number) { + return m + this.n.length; // error, 'length' does not exist on 'number' }, - implicitThis(m: number): number { return m; } + implicitThis(m: number): number { return m; } }; let i: I = o; let o2: I = { @@ -45,7 +45,8 @@ o.implicitThis = c.explicitThis; // ok, implicitThis(this:any) is assignable to o.implicitThis = i.explicitThis; i.explicitThis = function(m) { return this.n.length; // error, this.n: number -} +} + //// [looseThisTypeInFunctions.js] var C = (function () { @@ -67,7 +68,7 @@ c.explicitVoid = c.explicitThis; // error, 'void' is missing everything var o = { n: 101, explicitThis: function (m) { - return m + this.n.length; // ok, this.n: any + return m + this.n.length; // error, 'length' does not exist on 'number' }, implicitThis: function (m) { return m; } };