78 lines
1 KiB
Text
78 lines
1 KiB
Text
=== tests/cases/conformance/types/thisType/thisTypeAndConstraints.ts ===
|
|
class A {
|
|
>A : A
|
|
|
|
self() {
|
|
>self : () => this
|
|
|
|
return this;
|
|
>this : this
|
|
}
|
|
}
|
|
|
|
function f<T extends A>(x: T) {
|
|
>f : <T extends A>(x: T) => void
|
|
>T : T
|
|
>A : A
|
|
>x : T
|
|
>T : T
|
|
|
|
function g<U extends T>(x: U) {
|
|
>g : <U extends T>(x: U) => void
|
|
>U : U
|
|
>T : T
|
|
>x : U
|
|
>U : U
|
|
|
|
x = x.self();
|
|
>x = x.self() : U
|
|
>x : U
|
|
>x.self() : U
|
|
>x.self : () => U
|
|
>x : U
|
|
>self : () => U
|
|
}
|
|
x = x.self();
|
|
>x = x.self() : T
|
|
>x : T
|
|
>x.self() : T
|
|
>x.self : () => T
|
|
>x : T
|
|
>self : () => T
|
|
}
|
|
|
|
class B<T extends A> {
|
|
>B : B<T>
|
|
>T : T
|
|
>A : A
|
|
|
|
foo(x: T) {
|
|
>foo : (x: T) => void
|
|
>x : T
|
|
>T : T
|
|
|
|
x = x.self();
|
|
>x = x.self() : T
|
|
>x : T
|
|
>x.self() : T
|
|
>x.self : () => T
|
|
>x : T
|
|
>self : () => T
|
|
}
|
|
bar<U extends T>(x: U) {
|
|
>bar : <U extends T>(x: U) => void
|
|
>U : U
|
|
>T : T
|
|
>x : U
|
|
>U : U
|
|
|
|
x = x.self();
|
|
>x = x.self() : U
|
|
>x : U
|
|
>x.self() : U
|
|
>x.self : () => U
|
|
>x : U
|
|
>self : () => U
|
|
}
|
|
}
|
|
|