Skip to content

v1.2.0: Refactor & Solid TypeScript support

Compare
Choose a tag to compare
@kitten kitten released this 14 Jan 18:09

Sorry for the many releases and the noise that this refactor has generated! 😅
This release note summarises some of the changes that have been published since v1.

Uncurrying Refactor

Wonka's internal types have been completely overhauled! All internal-only
callbacks are now explicitly uncurried, including sinkT('a) and (.talkbackT) => unit.
Type aliases have also been added for sinks (sinkT('a)) and sources (sourceT('a))
which should make the codebase and signatures a lot easier to read.

Meanwhile the variants have been cleaned up. There's no duplicate End event.
Instead, when a sink requests a source to be completed it now sends Close.

TypeScript Support

This change is the most significant and really exciting! Wonka now has full TypeScript support!

Some functions have been explicitly curried so that the usage of all functions that Wonka exposes
are idiomatic. The JS bundle also exposes a pipe function. This allows TypeScript users to
write code that looks surprisingly much like RxJS code:

import { pipe, fromArray, map, filter, forEach } from 'wonka';

pipe(
  fromArray([1, 2, 3, 4]),
  map(x => x * 2),
  filter(x => x > 2),
  forEach(x => console.log(x))
);

/* logs: 4, 6, 8 */

Minor additions

  • Subjects are now supported!
  • added toPromise
  • added tap

Minor refactors

The library now relies on bs-rebel instead of raw
Belt based code that was used mostly for Belt.MutableMap. Rebel compiles away
to nice JS Array operations most of the time and falls back to Belt for bsb-native compilation.