Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
jakelazaroff
on Nov 5, 2019
|
parent
|
context
|
favorite
| on:
TypeScript 3.7
For array types, I don't think there's a way. You can type x as a tuple like this:
const x: [number, number] = [1, 2];
In which case you'll only be able to access indices zero and one.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: