From 33839b4b8a8e80fd8a2e299b819ab23755ba6e31 Mon Sep 17 00:00:00 2001 From: gcanti Date: Wed, 14 Feb 2018 12:30:34 +0100 Subject: [PATCH] fix `AnyType` by extending `Type` --- CHANGELOG.md | 5 +++++ package.json | 2 +- src/index.ts | 2 +- typings-checker/index.ts | 7 +++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc2d69c17..c7f7e2e3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,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. +# 1.0.1 + +* **Bug Fix** + * fix `AnyType` by extending `Type` (@gcanti) + # 1.0.0 * **Breaking Change** diff --git a/package.json b/package.json index 7d3d272c1..bdf37fb12 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io-ts", - "version": "1.0.0", + "version": "1.0.1", "description": "TypeScript compatible runtime type system for IO validation", "files": ["lib"], "main": "lib/index.js", diff --git a/src/index.ts b/src/index.ts index a489278ab..47404b317 100644 --- a/src/index.ts +++ b/src/index.ts @@ -143,7 +143,7 @@ export class UndefinedType extends Type { const undefinedType: UndefinedType = new UndefinedType() -export class AnyType extends Type { +export class AnyType extends Type { readonly _tag: 'AnyType' = 'AnyType' constructor() { super('any', (_): _ is any => true, success, identity) diff --git a/typings-checker/index.ts b/typings-checker/index.ts index 427e6a734..a2e876c40 100644 --- a/typings-checker/index.ts +++ b/typings-checker/index.ts @@ -360,3 +360,10 @@ export const Action = t.union([ // ActionType: t.Type<"Action1" | "Action2", "Action1" | "Action2", t.mixed> const ActionType = pluck(Action, 'type') + +// +// AnyType +// + +declare const Any1: t.AnyType | t.InterfaceType +Any1.decode(1)