Join Nostr
2025-01-23 12:10:31 UTC

Axel Rauschmayer on Nostr: // #TypeScript syntax: tuple (not array). Are there more? const tuple1 = ['a', 1]; // ...

// #TypeScript syntax: tuple (not array). Are there more?

const tuple1 = ['a', 1];
// (string | number)[]

// Non-empty tuple
const tuple2 = ['a', 1] satisfies [unknown, ...unknown[]];
// [string, number]

// Any tuple
const tuple3 = ['a', 1] satisfies [] | unknown[];
// [string, number]