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

Which is exactly what was used in the code exemplifying something else in the second example - so that confused me (never having written any TS) too.


Yeah, typically you want a record type for something like a mapping over potentially arbitrary keys (via an index type) to values of known type, and an object type (which can have optional keys) when you do know exactly what shape you expect and want to enforce it.




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

Search: