this post was submitted on 29 Jul 2025
-1 points (44.4% liked)
Programming
14338 readers
6 users here now
All things programming and coding related. Subcommunity of Technology.
This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Could be that I misread but I think you're misunderstanding types in Typescript.
You have an array of 1 or 2 values of unbounded size. You put two values in but could have put 1000 in, your type doesn't say anything about that. You can only put ones or twos in there though.
I think your first line is equivalent to saying:
I haven't checked though so I might be wrong..