←back to thread

218 points generichuman | 2 comments | | HN request time: 0.502s | source
Show context
90s_dev ◴[] No.44001031[source]
Tuples: {number, string}

Arrays: {number}

How does it disambiguate it? Are single-element tuples just never used in practice? To be fair, maybe the only time I've had to use them in TypeScript is via Parameters<T>

replies(2): >>44004244 #>>44005545 #
1. hisham_hm ◴[] No.44005545[source]
In our experience, single-element tuples are just never used in practice. There has been some discussion on how to add syntax for them, but I think it's more of a desire for orthogonality than for a practical need.
replies(1): >>44005795 #
2. 90s_dev ◴[] No.44005795[source]
Yeah I can't imagine any scenario where it's not just a value or an array of values that happens to have only one value right now.