tiny-decoders
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -0,1 +1,6 @@ | ||
### Version 3.0.1 (2019-08-08) | ||
- Fixed an oversight regarding the recommended type annotation for `autoRecord` | ||
decoders in Flow. No code changes. | ||
### Version 3.0.0 (2019-08-08) | ||
@@ -2,0 +7,0 @@ |
{ | ||
"name": "tiny-decoders", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "author": "Simon Lydell", |
@@ -136,3 +136,3 @@ # tiny-decoders [![Build Status][travis-badge]][travis-link] ![no dependencies][deps-tiny-decoders] [![minified size][min-tiny-decoders]][bundlephobia-tiny-decoders] | ||
error messages. The following is the recommended way of annotating record | ||
decoders, in both TypeScript and Flow: | ||
decoders in TypeScript: | ||
@@ -178,2 +178,28 @@ ```ts | ||
In Flow, annotate like this: | ||
```js | ||
import { record, autoRecord } from "tiny-decoders"; | ||
type Person = {| | ||
name: string, | ||
age: number, | ||
|}; | ||
const personDecoder = record((field): Person => ({ | ||
name: field("name", string), | ||
age: field("age", number), | ||
})); | ||
// or: | ||
const personDecoder2: Decoder<Person> = record(field => ({ | ||
name: field("name", string), | ||
age: field("age", number), | ||
})); | ||
const personDecoderAuto: Decoder<Person> = autoRecord({ | ||
name: string, | ||
age: number, | ||
}); | ||
``` | ||
See the [TypeScript type annotations example][typescript-type-annotations] and | ||
@@ -180,0 +206,0 @@ the [Flow type annotations example][example-type-annotations] for more |
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
89688
1147