HN2new | past | comments | ask | show | jobs | submitlogin

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>



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.


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.


Now I am curious what {number, string, number} would be considered as.


it's a three element tuple.


That was my guess, just as {n, n, n, n} would be a four element tuple, right?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: