diff --git a/tests/cases/compiler/noImplicitThisObjectLiterals.ts b/tests/cases/compiler/noImplicitThisObjectLiterals.ts deleted file mode 100644 index abd5d9dcfba..00000000000 --- a/tests/cases/compiler/noImplicitThisObjectLiterals.ts +++ /dev/null @@ -1,10 +0,0 @@ -// @noImplicitThis: true -let o = { - d: this, // error, this: any - m() { - return this.d.length; // error, this: any - }, - f: function() { - return this.d.length; // error, this: any - } -} diff --git a/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates02.ts b/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates02.ts index 02f2a798831..c17b26f423c 100644 --- a/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates02.ts +++ b/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates02.ts @@ -9,7 +9,7 @@ export interface Foo { export const obj = { m(): this is Foo { - let dis = this as Foo; + let dis = this as {} as Foo; return dis.a != null && dis.b != null && dis.c != null; } } \ No newline at end of file diff --git a/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts b/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts index c238bb16ec8..94e657db9f3 100644 --- a/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts +++ b/tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts @@ -9,7 +9,7 @@ interface Foo { export const obj = { m(): this is Foo { - let dis = this as Foo; + let dis = this as {} as Foo; return dis.a != null && dis.b != null && dis.c != null; } } \ No newline at end of file diff --git a/tests/cases/conformance/expressions/thisKeyword/thisInObjectLiterals.ts b/tests/cases/conformance/expressions/thisKeyword/thisInObjectLiterals.ts index ddfbb790980..6219586b6e5 100644 --- a/tests/cases/conformance/expressions/thisKeyword/thisInObjectLiterals.ts +++ b/tests/cases/conformance/expressions/thisKeyword/thisInObjectLiterals.ts @@ -2,9 +2,10 @@ class MyClass { t: number; fn() { + type ContainingThis = this; //type of 'this' in an object literal is the containing scope's this var t = { x: this, y: this.t }; - var t: { x: MyClass; y: number }; + var t: { x: ContainingThis; y: number }; } } diff --git a/tests/cases/conformance/types/thisType/thisTypeInFunctions2.ts b/tests/cases/conformance/types/thisType/thisTypeInFunctions2.ts index a574c7a07e9..0d1581633c3 100644 --- a/tests/cases/conformance/types/thisType/thisTypeInFunctions2.ts +++ b/tests/cases/conformance/types/thisType/thisTypeInFunctions2.ts @@ -32,15 +32,14 @@ extend1({ }); extend2({ init() { - this // this: any because the contextual signature of init doesn't specify this' type + this // this: containing object literal type this.mine - this.willDestroy + //this.willDestroy }, mine: 13, foo() { - this // this: any because of the string indexer + this // this: containing object literal type this.mine - this.willDestroy } });