Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/typeguardkit/mod.ts>union

A TypeScript module to help construct type assertion functions and type guards.
Latest
function union
import { union } from "https://deno.land/x/typeguardkit@0.33.0/mod.ts";

union can be used to create a UnionAsserter without specifying a typeName.

Example:

import { _null, _string, Asserted, union } from "typeguardkit";

export const _stringOrNull = union(_string, _null);

export type stringOrNull = Asserted<typeof _stringOrNull>;

Type Parameters

Asserters extends ReadonlyArray<Asserter<unknown>>

Parameters

...memberAsserters: Asserters