import { UnionAsserter } from "https://deno.land/x/typeguardkit@0.33.0/mod.ts";
A UnionAsserter
is an Asserter
for the union of the Type
s of its
memberAsserters
.
The provided memberAsserters
are made accessible as a property of the
created UnionAsserter
.
The union
function can be used to create a UnionAsserter
without
specifying a typeName
.
Example:
import { _null, _string, Asserted, UnionAsserter } from "typeguardkit";
export const _stringOrNull = new UnionAsserter(
"stringOrNull",
[_string, _null],
);
export type stringOrNull = Asserted<typeof _stringOrNull>;
Constructors
new
UnionAsserter(typeName: string, memberAsserters: Asserters)Type Parameters
Asserters extends ReadonlyArray<Asserter<unknown>>