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
/
Union.ts
9 lines
(7 loc)
•
252 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
import
{
any
}
from
'@typed/logic'
import
{
Guard
,
TypeOf
}
from
'./Guard'
export
const
union = <A
extends
ReadonlyArray
<
Guard
<
any
>>>(
guards
: A, ):
Guard
<
TypeOf
<A[
number
]>> => ({
is
: (u): u is
TypeOf
<A[
number
]> =>
any
(
(
g
) =>
g.
is
(u), guards), })