These kinds of struggles with JavaScript and TypeScript are part of why I moved to Rust. I value the sanity checks the compiler provides: warning when a Result is ignored and refusing to compile when a match on an enum is missing a branch.
Also, in Rust, Result is for recoverable failures, while panic! is generally reserved for bugs, broken internal assumptions, or cases where the program has reached a state that it believed should be impossible.
all 3 comments