You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
do our conventions currently allow the syntax in JS code? Should they?
do our conventions currently allow the syntax in TS code? Should they?
TypeScript obviously has its own private member syntax (via the private keyword). We should see if they've expressed an opinion about how that syntax will interact with the JS syntax.
The text was updated successfully, but these errors were encountered:
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).
should allow the # 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
shouldn't use the # 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.The text was updated successfully, but these errors were encountered: