import { isLiteralOneOf } 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 one of literal type in preds
.
import is from "./is.ts";
const a: unknown = "hello";
if (is.LiteralOneOf(["hello", "world"] as const)(a)) {
// a is narrowed to "hello" | "world"
const _: "hello" | "world" = a;
}
Type Parameters
T extends readonly Primitive[]
Parameters
literals: T