Update looseThisTypeInFunctions baselines

This commit is contained in:
Nathan Shively-Sanders 2016-04-29 10:37:45 -07:00
parent c12cb83fb7
commit 755ba737da
2 changed files with 13 additions and 11 deletions

View File

@ -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'.
}
}

View File

@ -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; }
};