2023-10-06
2039
#typescript
Ohans Emmanuel
130088
Oct 6, 2023 ⋅ 7 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:

How to display notification badges on PWAs using the Badging API

Ding! You got a notification, but does it cause a little bump of dopamine or a slow drag of cortisol? […]

Chigozie Oduah
Sep 13, 2024 ⋅ 4 min read
JWT Authentication: Best Practices And When To Use It

JWT authentication: Best practices and when to use it

A guide for using JWT authentication to prevent basic security issues while understanding the shortcomings of JWTs.

Flavio Copes
Sep 12, 2024 ⋅ 5 min read

Auth.js adoption guide: Overview, examples, and alternatives

Auth.js makes adding authentication to web apps easier and more secure. Let’s discuss why you should use it in your projects.

Clara Ekekenta
Sep 12, 2024 ⋅ 10 min read
Lucia Auth: An Auth.js Alternative For Next.js Authentication

Lucia Auth: An Auth.js alternative for Next.js authentication

Compare Auth.js and Lucia Auth for Next.js authentication, exploring their features, session management differences, and design paradigms.

Paul Akinyemi
Sep 12, 2024 ⋅ 4 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