Skip to content

Releases: supermacro/neverthrow

Fix empty dist folder

22 Apr 15:44
Compare
Choose a tag to compare

New `ResultAsunc.fromThrowable`

21 Apr 20:26
Compare
Choose a tag to compare

Addresses #488 & implements the .fromThrowable method on ResultAsync.

Thanks to @ehaynes99 for implementing this πŸš€


πŸ‘‰ Reminder; I'm looking for a maintainer to help out:

#531

Emulation of Rusts `?` Result operator (implicit return for errors)

22 Oct 15:17
Compare
Choose a tag to compare

neverthrow now can support implicit return whenever there is an Err instance inside of a generator.

Context: #448

Thank you to @tsuburin for the contribution πŸš€


Additionally, the previous functionality around increasing the tuple size supported by neverthrow is now live and out of beta. Context: https://github.com/supermacro/neverthrow/releases/tag/v6.0.1-0

Release Candidate: Allow for type inference of tuples containing 49 or less elements

18 Apr 02:19
Compare
Choose a tag to compare

I am a simple man - I like my tuples like my coffee; small (but strong). But some of you are out here trying to wreak havoc on the world with very large tuples. Now you get type inference on these too πŸ™‚


This is a fix for #441

The fix allows for type inference on very large tuples (limit of 49).

Given the sensitive nature of the changes made at the type level, I've opted to release this incrementally and as an opt-in functionality for now.

To get this change, you'll need to update your neverthrow installation to use the @beta tag.

> npm install neverthrow@beta

I'll wait a bit before moving this over to default on npm.

Resolve accidental breaking change with type inference on array types

11 Dec 19:20
Compare
Choose a tag to compare

The combine* family of functions (both sync and async) broke any codebase that called these functions on arrays of varying lengths when the previous release was shipped:

https://github.com/supermacro/neverthrow/releases/tag/v5.1.0

The following fix was implemented to address this issue and ensure that arrays (not just tuples) work with the combine* family of functions.

#435

Why is this shipped as a MAJOR version change?

Because we are now explicitly depending on TypeScript's variadic tuple types feature, which came out in v4 of TypeScript:

https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-0.html#variadic-tuple-types

Acknowledgements

Thank you to @ghost91- for implementing the fix πŸ™

Type inference improvements for all of the "combine" functions!

24 Oct 13:24
Compare
Choose a tag to compare

Thanks to @incetarik for fixing a long-lasting developer inconvenience! #226

Now, all of the "combine" functions can now infer types correctly and treat the list argument as a tuple rather than an unbounded list!

i.e. Rather than having to do:

Result.combine([ ok(123), err('whopps!') ] as const)

You can just omit the as const now:

Result.combine([ ok(123), err('whopps!') ])

And neverthrow can figure out the type of the above tuple on its own!

Return `never` rather than `unknown` for error type of `ResultAsync.fromSafePromise`

09 Oct 19:22
Compare
Choose a tag to compare

Thank you to @ccjmne @lmcsu and @msheakoski for this improvement πŸ™

This release ships #425 - which ensures that the E type for ResultAsync.fromSafePromise is never by default - which makes a lot more sense / is more a "accurate" depiction of runtime behaviour.

Separate `combine` and `combineWithAllErrors` into sync & async APIs

28 Jul 03:27
Compare
Choose a tag to compare

Thank you to @tam-carre for implementing this fix!

Unfortunately there is no way to distinguish at runtime if an empty list is a list of ResultAsyncs or a list of Results.

Hence #381 ... which could cause runtime exceptions!

So we've had to make the unfortunate decision of splitting combine and combineWithAllErrors into a synchronous version (behind the Result namespace) and an asynchronous version (behind the ResultAsync namespace).

So now we have:

  • Result.combine
  • Result.combineWithAllErrors
  • ResultAsync.combine
  • ResultAsync.combineWithAllErrors

... of course, this is a breaking change, and as such neverthrow has now been bumped to version 5.0.0

Make `ResultAsync.fromPromise` and `ResultAsync.fromSafePromise` less strict!

10 Jul 16:50
Compare
Choose a tag to compare

Thanks to @bhvngt for this submission.

ResultAsync.fromPromise and ResultAsync.fromSafePromise are now able to accept anything that implements the PromiseLike interface - in other words; anything that is "thenable". This includes objects such as Bluebird Promises and any other non-native promise-like object!

Fix issue when calling `combine` on proxies

19 Nov 11:45
Compare
Choose a tag to compare

User kieran-osgood submitted a fix for a long standing issue whereby proxies were suddenly disappearing within calls to combine:

#228

This issue is now resolved!

Additionally, the docs have been updated to reference eslint-plugin-neverthrow.