Skip to main content
Module

x/silicon/deps.ts>isOneOf

Deno module to generate images from source code using Aloxaf/silicon.
Latest
function isOneOf
import { isOneOf } from "https://deno.land/x/silicon@v1.0.0/deps.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>[]