Releases: kennethnym/trycat
Releases · kennethnym/trycat
0.2.4
This release fixes incorrect cjs/mjs exports in package.json
.
0.2.3
This release updates unwrap/unwrapErr/expect/expectErr messages to match Rust's implementation:
unwrap
onErr
now throws an error with the error message being the containing error value- e.g.
err("emergency").unwrap()
throws anError
withemergency
as the message
- e.g.
unwrapErr
onOk
now throws an error with the error message being the containing value- e.g.
ok(123).unwrapErr()
throws anError
with123
as the message
- e.g.
expect
onErr
now throws an error with the provided message and the containing error value as the message- e.g.
err("failed").expect("should not fail")
throws anError
withshould not failed: failed
as the message
- e.g.
expectErr
onOk
now throws an error with the provided message and the containing value as the message- e.g.
ok("hello").expectErr("should fail")
throws anError
withshould fail: hello
as the message
- e.g.
0.2.2
- Fixed an issue where
trys
would always infer the passed function as() => void
, thus causing the return type to always beResult<void, unknown>
. Now,trys
should correctly infer the return type of the function as expected - Corrected some mistakes in README and some housekeeping
0.2.1
You can now return an empty ok
or err
:
function someWork(): Result<void, void> {
// ... stuff
if (someError) {
return err()
}
// ... more stuff
return ok()
}
trys
and tryp
will now also infer the void type correctly if the given function and promise returns void
0.2.0
This release fixes the issue where the transpiled JS code is not published to npm.
v0.1.0
Initial release