Last active
February 27, 2019 20:43
-
-
Save JozefFlakus/4121ffe104634c9cc1d8eb9b158f19f3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const userSchema: t.type({ | |
id: t.string, | |
name: t.string, | |
age: t.number, | |
roles: t.array(t.union([ | |
t.literal('ADMIN'), | |
t.literal('GUEST'), | |
])), | |
}); | |
// ... | |
const effect$ = r.pipe( | |
r.matchPath('/'), | |
r.matchType('POST'), | |
r.useEffect(req$ => req$.pipe( | |
use(requestValidator$({ body: userSchema })), | |
// .. | |
))); | |
👇 | |
(typeof req.body) = { | |
id: string; | |
name: string; | |
age: number; | |
roles: ('ADMIN' | 'GUEST')[]; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment