mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 03:23:08 -06:00
Update tests
This commit is contained in:
parent
2ca6164fea
commit
e512376b0c
@ -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
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -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 };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user