top | item 30008107

(no title)

dmarchuk | 4 years ago

I've never had any issues with enums, namespaces or private keywords (can't speak for decorators as I haven't used them yet). Although I do understand the reasoning for using the '#somePrivateField' rather than 'private somePrivateField'.

But features like enums are part of the reason why we even have tools like TypeScript, because JavaScript lacks these features.

discuss

order

wdb|4 years ago

I wish TypeScript somehow would use #-private fields underwater when compiling code. `#field` is pretty confusing; I keep thinking it's a comment and it looks ugly

dmarchuk|4 years ago

Although I do understand the reasoning in the article, I completely agree with you.

Switching between Python and TypeScript/JavaScript all the time, using ‘#’ to define private field feels weird and I personally prefer more explicit way of writing code. Plus AFAIK the ‘private someField’ is common in other languages (Java, Scala,…).