Skip to content

Releases: pelotom/unionize

v3.1.0

26 Feb 20:28
Compare
Choose a tag to compare

Expose TaggedRecord (#70)

v3.0.2

16 Jul 19:53
Compare
Choose a tag to compare

Fixes bug with nested unions being untagged (#61)

v3.0.1

18 Jun 16:47
Compare
Choose a tag to compare

Fix no-arg check to avoid matching objects with all optional properties (#48)

v3.0.0

18 Jun 03:43
Compare
Choose a tag to compare

Ban TagProp as a usable property in variants when no ValProp is used (#56). This is technically a breaking change but probably won't break code that didn't have latent bugs.

v2.2.0

02 Apr 21:07
Compare
Choose a tag to compare

Fix for TypeScript 3.4 when using arrays for values:

const Foo = unionize({ array: ofType<boolean[]>() }, { value: 'value' });

// no type error in unionize@<=2.1.2 under typescript@3.4.1:
Foo.array('whoops');

v2.1.2

11 May 06:49
Compare
Choose a tag to compare

Fixes #39

v2.1.1

10 May 21:11
Compare
Choose a tag to compare

Fixes #34

v2.1.0

08 May 23:21
Compare
Choose a tag to compare

Allow including tags in variant types, so that you can name your variants with interfaces:

interface Foo {
  tag: 'foo';
  x: number;
}

interface Bar {
  tag: 'bar';
  y: boolean;

const T = unionize({
  foo: ofType<Foo>(),
  bar: ofType<Bar>(),
});

v2.0.0

23 Apr 21:08
Compare
Choose a tag to compare

Breaking changes

  • A new API for specifying the default case (using key default in the cases object) (#19)
  • Specify tag and value property names via a config object instead of positional arguments (#22)

Other enhancements

  • Uncurried variants of match (#21)
  • A simplified version of match, transform, for creating functions of the union type to itself (#23)
  • Creation functions for variants of value type {} no longer require an argument (#31)
  • Hygienic type operators UnionOf, RecordOf, TagsOf for extracting the types associated with a unionized object (#32)

Bug fixes

  • Fix issue where _Record wasn't using the actual object that was passed in (#20)

See the README for more details. Thanks to @twop for his significant contributions to this release!

v1.0.1

07 Apr 17:41
Compare
Choose a tag to compare

Fixes #16.