2 ms·
> I'm pretty sure I'd see multiple cases where the function would return different types depending on a code path. Quite commonly by design, or, “why union (an
by dragonwriter 3y ago
> I'm pretty sure I'd see multiple cases where the function would return different types depending on a code path.
Quite commonly by design, or, “why union (and sum) types are a thing”.
Something returning type “Foo | nil” is very often going to return Foo on one branch and nil on another.