Robin Pokorny
Aug 11, 2021

--

Hey Michael,

Thanks for your point of view.

What might be important to emphasise is that in TypeScript, Option type is not build in. Otherwise I'd use that.

What I'm presenting is a (IMHO) lightweight implementation of Option pattern that does not need an additional wrapping structure.

You could represent my problem as OptionA<OptionB<ReturnType>>. If both OptionA and OptionB are both implemented as Nullable (`None = null`), I cannot distinguish `NoneA` from `JustA(NoneB)`. Hope that makes sense.

The utility functions are just a consequence of that, not the goal.

I'd be happy if you could help me update the article, so it is more clear.

--

--

Robin Pokorny
Robin Pokorny

Written by Robin Pokorny

Architecture & Tech Leadership — Speaks — Loves maths — Reads specs — Podcasts — Lives in Berlin — robinpokorny.com

Responses (1)