Skip to content

Releases: joanllenas/ts.data.json

v3.1.0

05 May 14:22
Compare
Choose a tag to compare

Features

  • Added the new allOf() decoder (docs).
    Note: An allOf decoder existed in v2+, but it did not behave as expected. This new version merges all provided decoders and infers the merged type.

Enhancements

  • Improved the literal() decoder type safety, which now infers the literal type instead of a broad type.

Example:

v3.0.0

JsonDecoder.literal('hello') // Decoder<string>

v3.1.0

JsonDecoder.literal('hello') // Decoder<'hello'>

v3.0.0

20 Mar 20:47
5d237e4
Compare
Choose a tag to compare

Release v3 of ts.data.json

Tree Shaking, New Decoders, and DX Improvements

This PR introduces version 3 of ts.data.json, bringing several enhancements:

  • Added tree-shaking support to reduce bundle size.
  • Introduces new decoders.
  • Enhancements to the DX.
  • Improved performance and usability while maintaining backward compatibility as much as possible.

All changes are documented in the migration guide.

v2.3.1

16 Mar 00:59
2b1c490
Compare
Choose a tag to compare

This release contains only TSDoc documentation enhancements to improve IntelliSense and documentation website generation.

v2.3.0

14 Mar 00:08
1f9abb8
Compare
Choose a tag to compare

Features

Chores

  • Modernize project: remove TSLint, add ESLint, vite, esbuild and configure Vitest for testing.

  • Improve json-decoder documentation and intellisense.

  • Update README.md to improve clarity in examples and usage instructions for JSON decoders.

  • Add CI/CD pipeline configuration for automated testing and NPM publishing

v2.2.0

24 Sep 11:11
Compare
Choose a tag to compare

Features

  • Added a new decoder for empty objects JsonDecoder.emptyObject (fixes #34) (docs)

Example:

JsonDecoder.emptyObject.decode({}); // Ok<{}>({value: {}})
JsonDecoder.emptyObject.decode({ a: 1 }); // Err({error: '{a:1} is not a valid empty object'})

v2.1.1

27 Jun 15:50
Compare
Choose a tag to compare

This release contains a bug fix contributed by @mlocati 🎉

v2.1.0

23 Oct 21:43
Compare
Choose a tag to compare

Feature

  • Added FromDecoder<D> to infer types from decoder declarations. (docs)

Without FromDecoder

type User = {
  firstname: string;
  lastname: string;
};

const userDecoder = JsonDecoder.object<User>(
  {
    firstname: JsonDecoder.string,
    lastname: JsonDecoder.string
  },
  'User'
);

With FromDecoder

const userDecoder = JsonDecoder.object(
  {
    firstname: JsonDecoder.string,
    lastname: JsonDecoder.string
  },
  'User'
);
type User = FromDecoder<typeof userDecoder>;

v2.0.0

19 May 08:59
Compare
Choose a tag to compare

In this release

  • Removed deprecated APIs:
Before After
onDecode() fold()
decodePromise() decodeToPromise()
then() chain()

BREAKING CHANGES

  • onDecode() is now fold().
  • decodePromise() is now decodeToPromise().
  • then() is now chain().
  • Upgraded to TypeScript v4

v1.7.0

18 Mar 20:55
Compare
Choose a tag to compare

In this release

Before After
onDecode() fold()
decodePromise() decodeToPromise()
then() chain()

v1.6.1

02 Mar 10:34
Compare
Choose a tag to compare

Added CJS and ESM builds.