Union

Union

import { Union } from "@fed1/jsos";

A JSFunction that creates a TUnionType. A union type is a type that includes all of the values of the union member types.

Example:

const TMyUnion = Union(JSString, JSNumber);

isA("foo", JSString); // true
isA("foo", TMyUnion); // true
isA(5, JSNumber); // true
isA(5, TMyUnion); // true
isA([], TMyUnion); // false