import { refinement } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { tuple } = refinement;
Create a Refinement from an array of refinements, where each index of a type much match the originated refinement type.
Examples
Example 1
Example 1
import * as R from "./refinement.ts";
const tuple = R.tuple(R.number, R.string);
const result1 = tuple(null); // false
const result2 = tuple([]); // false
const result3 = tuple(["Hello", 1]); // false
const result4 = tuple([1, "Hello"]);
// true, variable has type [number, string]
const result5 = tuple([1, "Hello", "Goodbye"]); // false
Parameters
...items: [K in keyof A]: Refinement<unknown, A[K]>
Returns
Refinement<unknown, [K in keyof A]: A[K]>