UNPKG

@typed/io

Version:

Runtime IO type system

7 lines (5 loc) 259 B
import { isNull } from '@typed/logic' import { Guard, TypeOf } from './Guard' import { union } from './Union' export const Null: Guard<null> = Guard.is(isNull) export const nullable = <A extends Guard<any>>(g: A): Guard<TypeOf<A> | null> => union([g, Null])