15 lines
235 B
TypeScript
15 lines
235 B
TypeScript
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>();
|
|
}
|
|
}
|