re: TypeScript tips from Kotlin developer - const VIEW POST

FULL DISCUSSION
 

Oh, not just in TypeScript: in JavaScript too. That's an advice I repeatedly tell as a good practice.

But don't ever forget that it will not make your objects immutable.

 

Yeah this is a really important distinction. const and val are read only value references, but they don't mean that the value is an immutable value. You can still change the state of the object, and you don't get any of the guarantees around thread safety mentioned in the linked article.

code of conduct - report abuse