diff --git a/CHANGELOG.md b/CHANGELOG.md index bfe46f09..4ee476b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,11 @@ **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 2.2.22 + +- **Bug Fix** + - Test for readonly type when optimizing tagged unions, #719 + # 2.2.21 - **Bug Fix** diff --git a/package-lock.json b/package-lock.json index 874a36cf..f888869e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "io-ts", - "version": "2.2.20", + "version": "2.2.22", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "io-ts", - "version": "2.2.20", + "version": "2.2.22", "license": "MIT", "devDependencies": { "@definitelytyped/dtslint": "^0.0.163", diff --git a/package.json b/package.json index 265d1034..20650f72 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "2.2.21", + "version": "2.2.22", "description": "TypeScript runtime type system for IO decoding/encoding", "main": "lib/index.js", "module": "es6/index.js", diff --git a/test/2.1.x/union.ts b/test/2.1.x/union.ts index 44975d07..bcdf8ba7 100644 --- a/test/2.1.x/union.ts +++ b/test/2.1.x/union.ts @@ -238,6 +238,15 @@ describe.concurrent('union', () => { } ) }) + + it('readonly', () => { + assert.strictEqual(t.getTags(t.readonly(t.strict({ a: t.string }))), t.emptyTags) + assert.deepStrictEqual(t.getTags(t.readonly(t.strict({ tag: t.literal('a') }))), { tag: ['a'] }) + assert.deepStrictEqual(t.getTags(t.readonly(t.strict({ tag: t.literal('a'), type: t.literal('b') }))), { + tag: ['a'], + type: ['b'] + }) + }) }) it('getIndex', () => {