There is rarely a head-scratcher in TypeScript as prominent as trying to access an object property via iterating through its keys. I tried to “improve” Object.keys once. It’s a nice exercise on declaration merging but uh… I wouldn’t do that too often. Annotating definitely is one solution.

4m read timeFrom fettblog.eu
Post cover image
Table of contents
Why iterating over objects isn’t so easy #for-in loops #Bottom line #

Sort: