Just saw this tweet from @mattpocockuk, code below:
neverthrow is very similar to arrow (kotlin) and the way golang handle errors.
Why?
Great explanation on readme, very bottom:
Throwing and catching is very similar to using goto statements - in other words; it makes reasoning about your programs harder. Secondly, by using throw you make the assumption that the caller of your function is implementing catch. This is a known source of errors. Example: One dev throws and another dev uses the function without prior knowledge that the function will throw. Thus, and edge case has been left unhandled and now you have unhappy users, bosses, cats, etc.
With all that said, there are definitely good use cases for throwing in your program. But much less than you might think.
Would I use it in a production code (javascript/typescript)?
Probably not as it changes the way the language was designed. A lot of frameworks/libs/integrations expect the code to throw on error (e.g. sentry, datadog, express).
Use golang instead.
But definitely I would use it for pet projects, to make the code more functional and avoid goto calls.