Comparing version 1.8.3 to 1.8.4
@@ -17,2 +17,7 @@ # Changelog | ||
# 1.8.4 | ||
- **Polish** | ||
- autobind `decode` method (@gcanti) | ||
# 1.8.3 | ||
@@ -19,0 +24,0 @@ |
@@ -45,2 +45,3 @@ "use strict"; | ||
this.encode = encode; | ||
this.decode = this.decode.bind(this); | ||
} | ||
@@ -47,0 +48,0 @@ Type.prototype.pipe = function (ab, name) { |
@@ -0,1 +1,4 @@ | ||
/** | ||
* @deprecated | ||
*/ | ||
import { Reporter } from './Reporter'; | ||
@@ -2,0 +5,0 @@ /** |
{ | ||
"name": "io-ts", | ||
"version": "1.8.3", | ||
"version": "1.8.4", | ||
"description": "TypeScript compatible runtime type system for IO validation", | ||
@@ -44,3 +44,3 @@ "files": [ | ||
"benchmark": "2.1.4", | ||
"docs-ts": "github:gcanti/docs-ts", | ||
"docs-ts": "0.0.1", | ||
"doctoc": "^1.4.0", | ||
@@ -47,0 +47,0 @@ "dtslint": "github:gcanti/dtslint", |
@@ -11,3 +11,2 @@ [![build status](https://img.shields.io/travis/gcanti/io-ts/master.svg?style=flat-square)](https://travis-ci.org/gcanti/io-ts) | ||
- [The idea](#the-idea) | ||
@@ -204,3 +203,2 @@ - [TypeScript compatibility](#typescript-compatibility) | ||
# TypeScript integration | ||
@@ -257,3 +255,3 @@ | ||
| intersection | `A & B` | `t.intersection([ A, B ])` | | ||
| keyof | `keyof M` | `t.keyof(M)` | | ||
| keyof | `keyof M` | `t.keyof(M)` (**only supports string keys**) | | ||
| recursive types | ✘ | `t.recursion(name, definition)` | | ||
@@ -275,3 +273,3 @@ | branded types / refinements | ✘ | `t.brand(A, predicate, brand)` | | ||
const Category: t.RecursiveType<t.Type<Category>> = t.recursion('Category', () => | ||
const Category: t.Type<Category> = t.recursion('Category', () => | ||
t.type({ | ||
@@ -297,3 +295,3 @@ name: t.string, | ||
const Foo: t.RecursiveType<t.Type<Foo>> = t.recursion('Foo', () => | ||
const Foo: t.Type<Foo> = t.recursion('Foo', () => | ||
t.interface({ | ||
@@ -305,3 +303,3 @@ type: t.literal('Foo'), | ||
const Bar: t.RecursiveType<t.Type<Bar>> = t.recursion('Bar', () => | ||
const Bar: t.Type<Bar> = t.recursion('Bar', () => | ||
t.interface({ | ||
@@ -312,4 +310,2 @@ type: t.literal('Bar'), | ||
) | ||
const FooBar = t.taggedUnion('type', [Foo, Bar]) | ||
``` | ||
@@ -575,1 +571,12 @@ | ||
- better performance, `O(log(n))` vs `O(n)` | ||
Beware that `keyof` is designed to work with objects containing string keys. If you intend to define a numbers enumeration, you have to use an `union` of number literals : | ||
```ts | ||
const HttpCode = t.union([ | ||
t.literal(200), | ||
t.literal(201), | ||
t.literal(202) | ||
// etc... | ||
]) | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
107770
2368
575