Hacker News new | past | comments | ask | show | jobs | submit login

One of the first things that made a bad impression on me was back in the day when classes were still used in the js world.

I was not pleased when it told me I have have to do

this.blahBlah = value

in the constructor because it didn't quite catch, and maybe still doesn't, that

Object.defineProperties(this, { bla: { value: ... } blah: {get, set} })

is completely legit

That said, I do prefer ts to vanilla. It's less work than maintaining d.ts files




But who want to use

    Object.defineProperties
when there is a clearer and shorter way?

Or am I misunderstanding something?


What's the shorter way of having an unmutable property?




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: