mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-09 12:15:34 -06:00
Update looseThisTypeInFunctions baselines
This commit is contained in:
parent
c12cb83fb7
commit
755ba737da
@ -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'.
|
||||
}
|
||||
}
|
||||
|
||||
@ -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; }
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user