I still struggle to see the advantage of Option<T> in a language with null-safe accessors and unions
function fnO(val?: number) {
if (val == null) {
return "NAH";
} else {
return (val * val).toString();
}
}
test("testing Options", () => {
let foo = undefined;
let bar = 2;
expect(fnO(foo)).toBe("NAH");
expect(fnO(bar)).toBe("4");
});
Your readme states> FP's languages approach of rather not having null at all
But `None` is just another null / undefined, which brings along a bunch of non-idiomatic code around handling it.