2024-10-01
2526
#typescript
Ohans Emmanuel
130088
Oct 1, 2024 ⋅ 9 min read

How to dynamically assign properties to an object in TypeScript

Ohans Emmanuel Visit me at ohansemmanuel.com to learn more about what I do!

Recent posts:

javascript is null or empty function

How to check for null, undefined, or empty values in JavaScript

In most languages, we only have to cater to null. But in JavaScript, we have to cater to both null and undefined. How do we do that?

Lewis Cianci
Feb 14, 2025 ⋅ 4 min read
MERN Stack: Overview With Examples

What is the MERN stack? Overview with examples

Discover how the MERN stack (MongoDB, Express.js, React, Node.js) enables developers to build dynamic, performant, modern websites and apps.

Nefe Emadamerho-Atori
Feb 13, 2025 ⋅ 20 min read
Leveraging Parallel Computing In Node.js

Leveraging parallel computing in Node.js

Use parallel computing in Node.js with worker threads to optimize performance, handle CPU-intensive tasks, and utilize multi-core processors.

David Omotayo
Feb 13, 2025 ⋅ 8 min read

A guide to modern frontend architecture patterns

Frontend architecture is the foundation of your frontend codebase. Here’s how to optimize the pattern that you choose.

Shalitha Suranga
Feb 12, 2025 ⋅ 9 min read
View all posts

3 Replies to "How to dynamically assign properties to an object in TypeScript"

  1. I know this is explicitly for TypeScript, and I think type declarations should always be first. But in general, you can also use a Map object. If it’s really meant to by dynamic, might as well utilize the power of Map.

  2. Hi, thanks for your valuable article
    please consider ‘keyof type’ in TypeScript, and add this useful solution if you are happy
    have nice time

Leave a Reply