UNPKG
@typed/io
Version:
latest (1.2.0)
1.2.0
1.1.2
1.1.1
1.1.0
1.0.0
Runtime IO type system
@typed/io
/
source
/
guard
/
refinement.ts
9 lines
(7 loc)
•
246 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
import { Refinement }
from
'@typed/lambda'
import { Guard }
from
'./Guard'
export function
refinement
<
A
,
B
extends
A
>(
from
: Guard<A>, refinement: Refinement<A, B>
): Guard<B>
{
return
{
is
: (u): u
is
B =>
from
.
is
(u) && refinement(u), } }