Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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: