The maybe function is a subtle monster that spreads it’s tentacles across the code-base. It’s alternating functionality of “does/doesn’t do something” makes code hard to understand, maintain and debug.
Example
Here’s a specific example, it’s a “maybe” function as it only returns the friends of a user, if the user is logged in. Basically it introduces a possible return null
.
function maybeGetUser(): User | null { |