Skip to content

Releases: kennethnym/trycat

0.2.4

02 May 22:52
Compare
Choose a tag to compare
0.2.4 Pre-release
Pre-release

This release fixes incorrect cjs/mjs exports in package.json.

0.2.3

02 May 21:59
Compare
Choose a tag to compare
0.2.3 Pre-release
Pre-release

This release updates unwrap/unwrapErr/expect/expectErr messages to match Rust's implementation:

  • unwrap on Err now throws an error with the error message being the containing error value
    • e.g. err("emergency").unwrap() throws an Error with emergency as the message
  • unwrapErr on Ok now throws an error with the error message being the containing value
    • e.g. ok(123).unwrapErr() throws an Error with 123 as the message
  • expect on Err 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 an Error with should not failed: failed as the message
  • expectErr on Ok now throws an error with the provided message and the containing value as the message
    • e.g. ok("hello").expectErr("should fail") throws an Error with should fail: hello as the message

0.2.2

01 May 17:43
Compare
Choose a tag to compare
0.2.2 Pre-release
Pre-release
  • Fixed an issue where trys would always infer the passed function as () => void, thus causing the return type to always be Result<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

01 May 16:19
Compare
Choose a tag to compare
0.2.1 Pre-release
Pre-release

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

01 May 15:35
Compare
Choose a tag to compare
0.2.0 Pre-release
Pre-release

This release fixes the issue where the transpiled JS code is not published to npm.

v0.1.0

29 Apr 23:58
Compare
Choose a tag to compare
v0.1.0 Pre-release
Pre-release

Initial release