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