import { tuple } from "https://deno.land/x/typestruct@1.0.0-beta.5/mod.ts";
Create tuple struct. Tuple is array subtype. Ensure that the position and type of the elements match.
Examples
Example 1
Example 1
import { is, tuple, and, array, number, string, object } from "https://deno.land/x/typestruct@$VERSION/mod.ts";
import { assertEquals } from "https://deno.land/std@$VERSION/testing/asserts.ts";
const Tuple = tuple([string(), number(), object()]);
assertEquals(is(Tuple, ["", 0, {}]), true);
assertEquals(is(and(array()).and(Tuple), [1, 2, 3] as unknown), true);
Type Parameters
R extends readonly Struct<unknown>[]