You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While integrating typed throws in our codebase, I've noticed that withDependencies isn't quite as ergonomic because it's using rethrows instead of typed throws. The reason being that rethrows erases the inner error type to any Error. My pitch is to convert all instances of rethrows to typed errors.
You're very likely aware, just reiterating the concept for completeness:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
While integrating typed throws in our codebase, I've noticed that
withDependencies
isn't quite as ergonomic because it's usingrethrows
instead of typed throws. The reason being thatrethrows
erases the inner error type toany Error
. My pitch is to convert all instances ofrethrows
to typed errors.You're very likely aware, just reiterating the concept for completeness:
Instead of
rethrows
, we can now use typed throws:The compiler knows to infer that if
E == Never
, there's notry
required, which matches the behavior we get fromrethrows
:Beta Was this translation helpful? Give feedback.
All reactions