Загрузка видео...

Не удалось загрузить видео

На главную

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

13,590 просмотров • 1 год назад •via X (Twitter)

Комментарии: 10

Фото профиля Georg Unterholzner
Georg Unterholzner1 год назад

Very well explained, Cory!

Фото профиля lazy_coder
lazy_coder1 год назад

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
Tanguy Krotoff1 год назад

Fully-typed and fully-tested deepFreeze:

Фото профиля 𝕃𝕏𝔼
𝕃𝕏𝔼1 год назад

we need a 5th way

Фото профиля Cory House
Cory House1 год назад

I’m likely forgetting at least two

Фото профиля aiiiden 💫💖
aiiiden 💫💖1 год назад

@ezdubs_bot english to japanese

Фото профиля Nitesh ₿⚡️
Nitesh ₿⚡️1 год назад

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
Oliver1 год назад

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

Фото профиля Cory House
Cory House1 год назад

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

Фото профиля Cory House
Cory House1 год назад

Full course with a 20% discount:

Похожие видео