43 lines
655 B
Text
43 lines
655 B
Text
=== tests/cases/compiler/genericInterfaceImplementation.ts ===
|
|
interface IOption<A> {
|
|
>IOption : IOption<A>
|
|
>A : A
|
|
|
|
get(): A;
|
|
>get : () => A
|
|
>A : A
|
|
|
|
flatten<B>(): IOption<B>;
|
|
>flatten : <B>() => IOption<B>
|
|
>B : B
|
|
>IOption : IOption<A>
|
|
>B : B
|
|
}
|
|
|
|
class None<T> implements IOption<T>{
|
|
>None : None<T>
|
|
>T : T
|
|
>IOption : IOption<A>
|
|
>T : T
|
|
|
|
get(): T {
|
|
>get : () => T
|
|
>T : T
|
|
|
|
throw null;
|
|
>null : null
|
|
}
|
|
|
|
flatten<U>() : IOption<U> {
|
|
>flatten : <U>() => IOption<U>
|
|
>U : U
|
|
>IOption : IOption<A>
|
|
>U : U
|
|
|
|
return new None<U>();
|
|
>new None<U>() : None<U>
|
|
>None : typeof None
|
|
>U : U
|
|
}
|
|
}
|
|
|