Skip to content

Commit

Permalink
fix AnyType by extending Type<any>
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti committed Feb 14, 2018
1 parent ef875dc commit 33839b4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<any>` (@gcanti)

# 1.0.0

* **Breaking Change**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export class UndefinedType extends Type<undefined> {

const undefinedType: UndefinedType = new UndefinedType()

export class AnyType extends Type<any, any, any> {
export class AnyType extends Type<any> {
readonly _tag: 'AnyType' = 'AnyType'
constructor() {
super('any', (_): _ is any => true, success, identity)
Expand Down
7 changes: 7 additions & 0 deletions typings-checker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<any>
Any1.decode(1)

0 comments on commit 33839b4

Please sign in to comment.