mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
31 lines
503 B
TypeScript
31 lines
503 B
TypeScript
//// [tests/cases/compiler/genericInterfaceImplementation.ts] ////
|
|
|
|
//// [genericInterfaceImplementation.ts]
|
|
interface IOption<A> {
|
|
get(): A;
|
|
|
|
flatten<B>(): IOption<B>;
|
|
}
|
|
|
|
class None<T> implements IOption<T>{
|
|
get(): T {
|
|
throw null;
|
|
}
|
|
|
|
flatten<U>() : IOption<U> {
|
|
return new None<U>();
|
|
}
|
|
}
|
|
|
|
|
|
//// [genericInterfaceImplementation.js]
|
|
"use strict";
|
|
class None {
|
|
get() {
|
|
throw null;
|
|
}
|
|
flatten() {
|
|
return new None();
|
|
}
|
|
}
|