Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

tuple

import { tuple } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/showable.ts";

Create a Showable instance for a tuple type by providing Showable instances for each element in the tuple. The resulting show function will format the tuple as a string with square brackets and comma-separated values.

@example
import * as S from "./showable.ts";
import * as N from "./number.ts";
import * as Str from "./string.ts";

const ShowableTuple = S.tuple<[string, number, boolean]>(
  Str.ShowableString,
  N.ShowableNumber,
  { show: (b: boolean) => b.toString() }
);

const tuple: [string, number, boolean] = ["hello", 42, true];
const result = ShowableTuple.show(tuple);
// "[hello, 42, true]"

const emptyTuple: [string, number, boolean] = ["", 0, false];
const emptyResult = ShowableTuple.show(emptyTuple);
// "[, 0, false]"
const tuple: <A extends ReadonlyArray<unknown>>(...shows: [K in keyof A]: Showable<A[K]>) => Showable<Readonly<A>>;