Open jattasNI opened 2 years ago
TypeScript's documentation for member visibility states that both the private
syntax and the #
are supported (if you target ES2021 or less, it uses WeakMap rather than the native syntax for #
). It doesn't take a position on using one or the other, besides their differences in behaviour (edit-time vs run-time privacy).
Some thoughts from today's meeting:
#
in our conventions but not take a stand on using it vs private
until NI devs and the community have time to form opinions about the new syntax#
syntax in TS codebases that target ES2021 or earlier because the WeakMap approach is likely poor performing
The JavaScript feature to set class members as private by prefixing their name with
#
is now supported in all modern browsers. This issue tracks its impact on our coding conventions.Things to look into:
private
keyword). We should see if they've expressed an opinion about how that syntax will interact with the JS syntax.