Skip to content

Commit

Permalink
Docs: InputOf operator example
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti committed Nov 4, 2020
1 parent 5847e81 commit 1de671b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Decoder.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ console.log(isRight(NumberFromString.decode('a'))) // => false

# Extracting static types from decoders

Static types can be extracted from decoders using the `TypeOf` operator
Static types can be extracted from decoders using the `TypeOf` and `InputOf` operators

```ts
export const Person = D.type({
Expand All @@ -364,6 +364,11 @@ type Person = {
age: number;
}
*/

type PersonInputType = D.InputOf<typeof Person>
/*
type PersonInputType = unknown
*/
```
Note that you can define an `interface` instead of a type alias
Expand Down

0 comments on commit 1de671b

Please sign in to comment.