import { isOneOf } from "https://deno.land/x/unknownutil@v3.6.0/mod.ts";
Return a type predicate function that returns true
if the type of x
is OneOf<T>
.
import is from "./is.ts";
const preds = [is.Number, is.String, is.Boolean];
const a: unknown = 0;
if (is.OneOf(preds)(a)) {
// a is narrowed to number | string | boolean
const _: number | string | boolean = a;
}
Type Parameters
T extends readonly Predicate<unknown>[]
Parameters
preds: T