Hacker News new | ask | show | jobs
by robpalmer 1610 days ago
#private fields are not slow when used natively.

It's true the down-levelled code that uses WeakMaps is slower. The decision to downlevel is in the hands of the user and is controlled by the tsconfig "target" option.

The only environment that needs downlevelled #private fields is IE11.

1 comments

Which value are you setting for target? I tried es2021, and it still doesn't give me native #. I cannot use esnext, because other stuff doesn't compile anymore.