61 lines
831 B
Plaintext
61 lines
831 B
Plaintext
|
=== tests/cases/compiler/genericImplements.ts ===
|
||
|
class A { a; };
|
||
|
>A : A
|
||
|
>a : any
|
||
|
|
||
|
class B { b; };
|
||
|
>B : B
|
||
|
>b : any
|
||
|
|
||
|
interface I {
|
||
|
>I : I
|
||
|
|
||
|
f<T extends A>(): T;
|
||
|
>f : <T extends A>() => T
|
||
|
>T : T
|
||
|
>A : A
|
||
|
>T : T
|
||
|
|
||
|
} // { f: () => { a; } }
|
||
|
|
||
|
// OK
|
||
|
class X implements I {
|
||
|
>X : X
|
||
|
>I : I
|
||
|
|
||
|
f<T extends B>(): T { return undefined; }
|
||
|
>f : <T extends B>() => T
|
||
|
>T : T
|
||
|
>B : B
|
||
|
>T : T
|
||
|
>undefined : undefined
|
||
|
|
||
|
} // { f: () => { b; } }
|
||
|
|
||
|
// OK
|
||
|
class Y implements I {
|
||
|
>Y : Y
|
||
|
>I : I
|
||
|
|
||
|
f<T extends A>(): T { return undefined; }
|
||
|
>f : <T extends A>() => T
|
||
|
>T : T
|
||
|
>A : A
|
||
|
>T : T
|
||
|
>undefined : undefined
|
||
|
|
||
|
} // { f: () => { a; } }
|
||
|
|
||
|
// OK
|
||
|
class Z implements I {
|
||
|
>Z : Z
|
||
|
>I : I
|
||
|
|
||
|
f<T>(): T { return undefined; }
|
||
|
>f : <T>() => T
|
||
|
>T : T
|
||
|
>T : T
|
||
|
>undefined : undefined
|
||
|
|
||
|
} // { f: <T>() => T }
|