Comment

Comment by seniorsassycat

Lots of comments seen to have missed that the article isn't recommending against private fields, only the private keyword.

Typescript and JavaScript have a newer brand # to make fields private. The native feature will have runtime benefits while the private keyword creates fields that's are public at runtime.

I still use the private keyword because constructor shorthand doesn't support brands.

    constructor (private field)
    constructor (#field) // error

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton