I want to leverage the private field declarations in lwc classes
create a service class and use #
class SapCarConfiguratorUtil {
#MULTIPICKLIST = 'multipicklist';
constructor(jsonResponse) {
console.log(this.#MULTIPICKLIST);
}
}
export {SapCarConfiguratorUtil}
https://developer.salesforce.com/docs/component-library/tools/playground
const your => (code) => here;
Deploy to org
ERROR deploying LightningComponentBundle lwc/sapCarConfiguratorUtil/sapCarConfiguratorUtil.js: LWC1509: Unexpected character '#' (7:4)
@yaminm private fields are stage 3, once they reach stage 4, and are implemented in modern browsers, we will enable it with the corresponding transpilation down to IE11, for now... we keep waiting.
Btw, keep in mind that we provides protected fields at the moment, only those with @api are truly public, while regular fields are basically protected.
Most helpful comment
@yaminm private fields are stage 3, once they reach stage 4, and are implemented in modern browsers, we will enable it with the corresponding transpilation down to IE11, for now... we keep waiting.
Btw, keep in mind that we provides protected fields at the moment, only those with
@apiare truly public, while regular fields are basically protected.