Skip to content

v2.0.1: feat: use generic classes to interpret the promise types

Compare
Choose a tag to compare
@stakach stakach released this 07 Jan 04:01
· 20 commits to master since this release

The previous version required that promise values were nilable.
i.e. Promise.new(String) == Promise::DeferredPromise(String?)

This is no longer the case
Promise.new(String) == Promise::DeferredPromise(String)

This was achieved by:

  1. Using generic classes to isolate the return value types of promise callbacks
  2. Using macros to differentiate between promise and regular return values without creating a union type
  3. Detecting NoReturn where a callback always raises and creating a Promise::DeferredPromise(Nil) for this case

Otherwise the library functions exactly as before.