TypeScript/tests/baselines/reference/thisTypeInClasses.types

146 lines
2.5 KiB
Text

=== tests/cases/conformance/types/thisType/thisTypeInClasses.ts ===
class C1 {
>C1 : C1
x: this;
>x : this
f(x: this): this { return undefined; }
>f : (x: this) => this
>x : this
>undefined : undefined
}
class C2 {
>C2 : C2
[x: string]: this;
>x : string
}
interface Foo<T> {
>Foo : Foo<T>
>T : T
x: T;
>x : T
>T : T
y: this;
>y : this
}
class C3 {
>C3 : C3
a: this[];
>a : this[]
b: [this, this];
>b : [this, this]
c: this | Date;
>c : this | Date
>Date : Date
d: this & Date;
>d : this & Date
>Date : Date
e: (((this)));
>e : this
f: (x: this) => this;
>f : (x: this) => this
>x : this
g: new (x: this) => this;
>g : new (x: this) => this
>x : this
h: Foo<this>;
>h : Foo<this>
>Foo : Foo<T>
i: Foo<this | (() => this)>;
>i : Foo<this | (() => this)>
>Foo : Foo<T>
j: (x: any) => x is this;
>j : (x: any) => x is this
>x : any
>x : any
}
declare class C4 {
>C4 : C4
x: this;
>x : this
f(x: this): this;
>f : (x: this) => this
>x : this
}
class C5 {
>C5 : C5
foo() {
>foo : () => void
let f1 = (x: this): this => this;
>f1 : (x: this) => this
>(x: this): this => this : (x: this) => this
>x : this
>this : this
let f2 = (x: this) => this;
>f2 : (x: this) => this
>(x: this) => this : (x: this) => this
>x : this
>this : this
let f3 = (x: this) => (y: this) => this;
>f3 : (x: this) => (y: this) => this
>(x: this) => (y: this) => this : (x: this) => (y: this) => this
>x : this
>(y: this) => this : (y: this) => this
>y : this
>this : this
let f4 = (x: this) => {
>f4 : (x: this) => () => this
>(x: this) => { let g = (y: this) => { return () => this; } return g(this); } : (x: this) => () => this
>x : this
let g = (y: this) => {
>g : (y: this) => () => this
>(y: this) => { return () => this; } : (y: this) => () => this
>y : this
return () => this;
>() => this : () => this
>this : this
}
return g(this);
>g(this) : () => this
>g : (y: this) => () => this
>this : this
}
}
bar() {
>bar : () => void
let x1 = <this>undefined;
>x1 : this
><this>undefined : this
>undefined : undefined
let x2 = undefined as this;
>x2 : this
>undefined as this : this
>undefined : undefined
}
}