You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The best places to start are with the examples in the `test/` directory, and the documentation for the [Decoder class](https://github.com/mojotech/json-type-validation/blob/master/docs/classes/_decoder_.decoder.md). At some point you may need documentation for dealing with the [Result type](https://github.com/mojotech/json-type-validation/blob/master/docs/modules/_result_.md).
11
8
12
9
### Type Parameters
13
10
14
-
Many of the decoder functions take an optional type parameter which determines
15
-
the type of the decoded value. In most cases typescript successfully infers
16
-
these types, although some specific decoders include documentation for
17
-
situations where the type is necessary (see the `constant` and `union`
18
-
decoders). You may still find that including the type parameter improves type
19
-
inference in situations where typescript's error messages are particularly
20
-
unhelpful.
11
+
Many of the decoder functions take an optional type parameter which determines the type of the decoded value. In most cases typescript successfully infers these types, although some specific decoders include documentation for situations where the type is necessary (see the `constant` and `union` decoders). You may still find that including the type parameter improves type inference in situations where typescript's error messages are particularly unhelpful.
12
+
13
+
As an example, a decoder for the `Pet` interface can be typechecked just as effectively using the type parameter as with the `Decoder<Pet>` annotation.
21
14
22
-
As an example, a decoder for the `Pet` interface can be typechecked just as
23
-
effectively using the type parameter as with the `Decoder<Pet>` annotation.
This library uses the [combinator pattern](https://wiki.haskell.org/Combinator_pattern)
36
-
to build decoders. The decoder primitives `string`, `number`, `boolean`,
37
-
`anyJson`, `constant`, `succeed`, and `fail` act as decoder building blocks that
38
-
each perform a simple decoding operation. The decoder combinators `object`,
39
-
`array`, `dict`, `optional`, `oneOf`, `union`, `withDefault`, `valueAt`, and
40
-
`lazy` take decoders as arguments, and combined the decoders into more
41
-
complicated structures. You can think of your own user-defined decoders as an
42
-
extension of these composable units.
43
-
44
-
26
+
This library uses the [combinator pattern](https://wiki.haskell.org/Combinator_pattern) to build decoders. The decoder primitives `string`, `number`, `boolean`, `anyJson`, `constant`, `succeed`, and `fail` act as decoder building blocks that each perform a simple decoding operation. The decoder combinators `object`, `array`, `dict`, `optional`, `oneOf`, `union`, `withDefault`, `valueAt`, and `lazy` take decoders as arguments, and combined the decoders into more complicated structures. You can think of your own user-defined decoders as an extension of these composable units.
0 commit comments