<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/typescript-iterating-over-objects-fd6e3ty6h" -->

---
title: TypeScript: Iterating over objects | daily.dev
description: 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”...
canonical: https://daily.dev/posts/typescript-iterating-over-objects-fd6e3ty6h
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: TypeScript: Iterating over objects | daily.dev
og:description: 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”...
og:url: https://daily.dev/posts/typescript-iterating-over-objects-fd6e3ty6h
og:image: https://api.daily.dev/og/posts/FD6e3Ty6H.png
og:image:alt: TypeScript: Iterating over objects
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript: Iterating over objects

**[fettblog.eu](https://daily.dev/sources/fettblog)** · 4 min read · 10 upvotes · 0 comments

## Summary

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.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://fettblog.eu/typescript-iterating-over-objects/>

---

Tags: [#logging](https://daily.dev/tags/logging), [#typescript](https://daily.dev/tags/typescript)

[View this post on daily.dev](https://daily.dev/posts/typescript-iterating-over-objects-fd6e3ty6h)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"TypeScript: Iterating over objects","url":"https://daily.dev/posts/typescript-iterating-over-objects-fd6e3ty6h","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/typescript-iterating-over-objects-fd6e3ty6h"},"datePublished":"2022-05-11T08:49:12.531Z","dateModified":"2022-05-11T08:49:12.531Z","description":"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”...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/8a5a80c65c690f847ed61e5654d8c8ce","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/8a5a80c65c690f847ed61e5654d8c8ce","isAccessibleForFree":true,"articleSection":"fettblog.eu","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"fettblog.eu","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/7ed17b042af344c58e5cfebd1680b30f","url":"https://daily.dev/sources/fettblog"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/typescript-iterating-over-objects-fd6e3ty6h","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":10},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"logging,typescript","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"fettblog.eu","item":"https://daily.dev/sources/fettblog"},{"@type":"ListItem","position":3,"name":"TypeScript: Iterating over objects"}]}
```

