mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-25 16:11:24 +08:00
20 lines
416 B
TypeScript
20 lines
416 B
TypeScript
|
|
|
|
var turns_out_to_be_100 = TsMonad.Maybe.just(10)
|
|
.caseOf({
|
|
just: n => n * n,
|
|
nothing: () => -1
|
|
});
|
|
|
|
var turns_out_to_be_nothing = TsMonad.Maybe.nothing<number>()
|
|
.caseOf({
|
|
just: n => n * n,
|
|
nothing: () => -1
|
|
});
|
|
|
|
var turns_out_to_be_true = TsMonad.Maybe.just(123)
|
|
.lift(n => n * 2)
|
|
.caseOf({
|
|
just: n => n === 246,
|
|
nothing: () => false
|
|
}); |