22 lines
317 B
TypeScript
22 lines
317 B
TypeScript
|
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();
|
||
|
}
|
||
|
}
|