Lwc: Private field declarations in classes (# support) error

Created on 15 Oct 2019  路  1Comment  路  Source: salesforce/lwc

Description

I want to leverage the private field declarations in lwc classes

Steps to Reproduce

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;

Expected Results

Deploy to org

Actual Results

ERROR deploying LightningComponentBundle lwc/sapCarConfiguratorUtil/sapCarConfiguratorUtil.js: LWC1509: Unexpected character '#' (7:4)

Version

API:46.0

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 @api are truly public, while regular fields are basically protected.

>All comments

@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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jodarove picture jodarove  路  5Comments

juvian picture juvian  路  5Comments

bmblb picture bmblb  路  3Comments

ekashida picture ekashida  路  4Comments

mattgoldspink picture mattgoldspink  路  5Comments