4 ms·
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
by 90s_dev 1y ago
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>
- johnisgood 1y agoNow I am curious what {number, string, number} would be considered as.
- hisham_hm 1y agoit's a three element tuple.
- johnisgood 1y agoThat was my guess, just as {n, n, n, n} would be a four element tuple, right?
- hisham_hm 1y agoIn 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.
- 90s_dev 1y agoYeah 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.