Accepted baselines.
This commit is contained in:
parent
dc1fbc24cd
commit
31d8cbe895
|
@ -1,8 +1,11 @@
|
|||
tests/cases/compiler/noImplicitThisFunctions.ts(13,12): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
|
||||
tests/cases/compiler/noImplicitThisFunctions.ts(17,38): error TS7041: The containing arrow function captures the global value of 'this' which implicitly has type 'any'.
|
||||
tests/cases/compiler/noImplicitThisFunctions.ts(18,22): error TS7041: The containing arrow function captures the global value of 'this' which implicitly has type 'any'.
|
||||
tests/cases/compiler/noImplicitThisFunctions.ts(20,36): error TS7041: The containing arrow function captures the global value of 'this' which implicitly has type 'any'.
|
||||
tests/cases/compiler/noImplicitThisFunctions.ts(21,50): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
|
||||
|
||||
|
||||
==== tests/cases/compiler/noImplicitThisFunctions.ts (2 errors) ====
|
||||
==== tests/cases/compiler/noImplicitThisFunctions.ts (5 errors) ====
|
||||
function f1(x) {
|
||||
// implicit any is still allowed
|
||||
return x + 1;
|
||||
|
@ -24,4 +27,14 @@ tests/cases/compiler/noImplicitThisFunctions.ts(17,38): error TS7041: The contai
|
|||
let f4: (b: number) => number = b => this.c + b;
|
||||
~~~~
|
||||
!!! error TS7041: The containing arrow function captures the global value of 'this' which implicitly has type 'any'.
|
||||
let f5 = () => () => this;
|
||||
~~~~
|
||||
!!! error TS7041: The containing arrow function captures the global value of 'this' which implicitly has type 'any'.
|
||||
|
||||
let f6 = function() { return () => this; };
|
||||
~~~~
|
||||
!!! error TS7041: The containing arrow function captures the global value of 'this' which implicitly has type 'any'.
|
||||
let f7 = function() { return function() { return this } };
|
||||
~~~~
|
||||
!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
|
||||
|
|
@ -16,6 +16,10 @@ function f3(z: number): number {
|
|||
|
||||
// error: `this` is `window`, but is still of type `any`
|
||||
let f4: (b: number) => number = b => this.c + b;
|
||||
let f5 = () => () => this;
|
||||
|
||||
let f6 = function() { return () => this; };
|
||||
let f7 = function() { return function() { return this } };
|
||||
|
||||
|
||||
//// [noImplicitThisFunctions.js]
|
||||
|
@ -34,3 +38,9 @@ function f3(z) {
|
|||
}
|
||||
// error: `this` is `window`, but is still of type `any`
|
||||
var f4 = function (b) { return _this.c + b; };
|
||||
var f5 = function () { return function () { return _this; }; };
|
||||
var f6 = function () {
|
||||
var _this = this;
|
||||
return function () { return _this; };
|
||||
};
|
||||
var f7 = function () { return function () { return this; }; };
|
||||
|
|
|
@ -33,3 +33,12 @@ let f4: (b: number) => number = b => this.c + b;
|
|||
>b : Symbol(b, Decl(noImplicitThisFunctions.ts, 16, 31))
|
||||
>b : Symbol(b, Decl(noImplicitThisFunctions.ts, 16, 31))
|
||||
|
||||
let f5 = () => () => this;
|
||||
>f5 : Symbol(f5, Decl(noImplicitThisFunctions.ts, 17, 3))
|
||||
|
||||
let f6 = function() { return () => this; };
|
||||
>f6 : Symbol(f6, Decl(noImplicitThisFunctions.ts, 19, 3))
|
||||
|
||||
let f7 = function() { return function() { return this } };
|
||||
>f7 : Symbol(f7, Decl(noImplicitThisFunctions.ts, 20, 3))
|
||||
|
||||
|
|
|
@ -46,3 +46,21 @@ let f4: (b: number) => number = b => this.c + b;
|
|||
>c : any
|
||||
>b : number
|
||||
|
||||
let f5 = () => () => this;
|
||||
>f5 : () => () => any
|
||||
>() => () => this : () => () => any
|
||||
>() => this : () => any
|
||||
>this : any
|
||||
|
||||
let f6 = function() { return () => this; };
|
||||
>f6 : () => () => any
|
||||
>function() { return () => this; } : () => () => any
|
||||
>() => this : () => any
|
||||
>this : any
|
||||
|
||||
let f7 = function() { return function() { return this } };
|
||||
>f7 : () => () => any
|
||||
>function() { return function() { return this } } : () => () => any
|
||||
>function() { return this } : () => any
|
||||
>this : any
|
||||
|
||||
|
|
Loading…
Reference in a new issue