deno
deno copied to clipboard
Support auto-accessors
Version: Deno 1.40.2
I'm trying to use Deno as my complete toolchain for writing a component using Lit. I'm trying out the new Stage 3 decorators.
When I compile using "experimentalDecorators": false
, the accessor
properties stay in the generated code, instead of being down-leveled.
For code like this,
@property()
accessor name = "World";
@property({ type: Number })
accessor count = 0;
tsc can generate output like this:
get name() {
return __classPrivateFieldGet(this, _MyElement_name_accessor_storage, "f");
}
set name(value) {
__classPrivateFieldSet(this, _MyElement_name_accessor_storage, value, "f");
}
get count() {
return __classPrivateFieldGet(this, _MyElement_count_accessor_storage, "f");
}
set count(value) {
__classPrivateFieldSet(this, _MyElement_count_accessor_storage, value, "f");
}
I'm using this tsconfig.json
in tsc 5.3.3:
"compilerOptions": {
"target": "ES6",
"experimentalDecorators": false,
"useDefineForClassFields": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"module": "esnext",
"moduleResolution": "Bundler",
"esModuleInterop": true,
"verbatimModuleSyntax": true,
"sourceMap": true,
},