3 ms·
> #private: […] This is not recommended for TypeScript projects, instead just use the existing private keyword. Why not? I was told the opposite: now that the
by jenadine 4y ago
> #private: […] This is not recommended for TypeScript projects, instead just use the existing private keyword.
Why not?
I was told the opposite: now that the feature is in JS natively, it can be used.
- conaclos 4y agoThe Deno style guide encourages the use of `#prop` over `private prop` [0]. Other guides such as the Google TypeScript Guide discourages their use [1] for now because they are transpiled to slow code. What I could conclude is: use `#` over `private` for runtimes that support them or projects that can target recent runtimes and browsers. [0] https://deno.land/manual@v1.29.3/references/contributing/style_guide#prefer--over-private https://deno.land/manual@v1.29.3/references/contributing/sty... [1] https://google.github.io/styleguide/tsguide.html#private-fields https://google.github.io/styleguide/tsguide.html#private-fie...
- bobbylarrybobby 4y agoProbably so that tsc can transpile it differently for older browsers.