Very timely, was just trying to understand how to improve error handling with typescript recently and came across neverthrow (https://github.com/supermacro/neverthrow) which looks promising…
Yeah, working with exceptions and Promise rejections is very annoying in Typescript as the error type is often any even when you yourself carefully always use Error instances to be able to get a stack trace etc. Theoreticallly at least some sub/system function might throw a string or whatever, so that has to be dealt with. Also subtyping Error classes to be able to convey error details is annoying and you'll then have to document all expected error types. And finally Typescript won't be able to help you ensure that you're dealing with all of them. This seems to solve all of that, but I haven't yet had a chance to try it out.