v1.13.0
Potentially breaking changes:
-
Changed the API interface of
dispatch()
. The previous version was too complicated and was hardly used. The new version is easier to use in practice, and has better type inference support in TypeScript and Flow.Previous usage:
const shape = dispatch( field('type', string), type => { switch (type) { case 'rect': return rectangle; case 'circle': return circle; } return fail('Must be a valid shape'); } );
New usage: docs
const shape = dispatch('type', { rectangle, circle });
Where
rectangle
andcircle
are decoders of which exactly one will be invoked.
-
Removed the
field()
decoder. It was not generic enough to stay part of the standard decoder library. (It was typically used in combination withdispatch()
, which now isn't needed anymore, see above.) -
pojo
decoder now returnsDecoder<{[string]: mixed}>
instead of the unsafeDecoder<Object>
.
Fixes and cleanup:
- Internal reorganization of modules
- Improve TypeScript support
- Reorganization of TypeScript declarations
- More robust test suite for TypeScript
- 100% TypeScript test coverage