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]
Published at
2025-01-23 12:10:31 UTCEvent JSON
{
"id": "0125e9ac5329d6ac698db5fdc737b53872907c1caf201d1d1143ab3859a20641",
"pubkey": "7a7a0978cc46ef7fd548fb125e51c04de7d4ca639417a21b56aa95e3711c0b38",
"created_at": 1737634231,
"kind": 1,
"tags": [
[
"proxy",
"https://fosstodon.org/@rauschma/113877596977178252",
"web"
],
[
"t",
"typescript"
],
[
"proxy",
"https://fosstodon.org/users/rauschma/statuses/113877596977178252",
"activitypub"
],
[
"L",
"pink.momostr"
],
[
"l",
"pink.momostr.activitypub:https://fosstodon.org/users/rauschma/statuses/113877596977178252",
"pink.momostr"
],
[
"-"
]
],
"content": "// #TypeScript syntax: tuple (not array). Are there more?\n\nconst tuple1 = ['a', 1];\n // (string | number)[]\n\n // Non-empty tuple\nconst tuple2 = ['a', 1] satisfies [unknown, ...unknown[]];\n // [string, number]\n\n // Any tuple\nconst tuple3 = ['a', 1] satisfies [] | unknown[];\n // [string, number]",
"sig": "7c468f964a302f9a2d562d14cef3c504ea8e59c4eed32a04e82c8578305dd52be67badccc2a74e7dfaf661e6cc1a8ea579a023314e189d1b773ae74fc3c04e0d"
}