Video yükleniyor...

Video Yüklenemedi

Ana Sayfaya Dön

In TypeScript, there are at least 4 ways to implement immutability. Here's how I choose between them.

13,590 görüntüleme • 1 yıl önce •via X (Twitter)

10 Yorum

Georg Unterholzner profil fotoğrafı
Georg Unterholzner1 yıl önce

Very well explained, Cory!

lazy_coder profil fotoğrafı
lazy_coder1 yıl önce

Question: At what point in the development cycle do you begin to worry about immutability? For solo or very small teams focused on deploying asap should this be a priority?

Tanguy Krotoff profil fotoğrafı
Tanguy Krotoff1 yıl önce

Fully-typed and fully-tested deepFreeze:

𝕃𝕏𝔼 profil fotoğrafı
𝕃𝕏𝔼1 yıl önce

we need a 5th way

Cory House profil fotoğrafı
Cory House1 yıl önce

I’m likely forgetting at least two

aiiiden 💫💖 profil fotoğrafı
aiiiden 💫💖1 yıl önce

@ezdubs_bot english to japanese

Nitesh ₿⚡️ profil fotoğrafı
Nitesh ₿⚡️1 yıl önce

Only in JavaScript, we declare something as const but then add an `as const` at the end of it to say, please remain immutable.

Oliver profil fotoğrafı
Oliver1 yıl önce

So how would you choose between the typescript versions? Mainly when to use `as const` vs `readonly/ReadOnly`

Cory House profil fotoğrafı
Cory House1 yıl önce

readonly is the only granular option. Otherwise I generally prefer “as const”

Cory House profil fotoğrafı
Cory House1 yıl önce

Full course with a 20% discount:

Benzer Videolar