TypeScript/tests/cases/conformance/types/thisType/thisTypeAndConstraints.ts

22 lines
317 B
TypeScript
Raw Normal View History

2015-11-06 17:55:08 +01:00
class A {
self() {
return this;
}
}
function f<T extends A>(x: T) {
function g<U extends T>(x: U) {
x = x.self();
}
x = x.self();
}
class B<T extends A> {
foo(x: T) {
x = x.self();
}
bar<U extends T>(x: U) {
x = x.self();
}
}