Skip to main content
Module

x/unknownutil/is.ts>isTupleOf

🦕 An utility pack for handling unknown type in deno
Go to Latest
function isTupleOf
import { isTupleOf } from "https://deno.land/x/unknownutil@v3.0.0/is.ts";

Return a type predicate function that returns true if the type of x is TupleOf<T>.

import is from "./is.ts";

const predTup = [is.Number, is.String, is.Boolean] as const;
const a: unknown = [0, "a", true];
if (is.TupleOf(predTup)(a)) {
 // a is narrowed to [number, string, boolean]
 const _: [number, string, boolean] = a;
}

Type Parameters

T extends readonly Predicate<unknown>[]

Parameters

predTup: T