mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -05:00
parent
3ab94983b4
commit
8aa0d5f96e
8 changed files with 20 additions and 4 deletions
|
@ -267,7 +267,7 @@ fn strip_config_from_emit_options(
|
||||||
typescript::strip::ImportsNotUsedAsValues::Remove
|
typescript::strip::ImportsNotUsedAsValues::Remove
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
..Default::default()
|
use_define_for_class_fields: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -372,6 +372,7 @@ impl Inner {
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"target": "esnext",
|
"target": "esnext",
|
||||||
|
"useDefineForClassFields": true,
|
||||||
}));
|
}));
|
||||||
let (maybe_config, maybe_root_uri) = {
|
let (maybe_config, maybe_root_uri) = {
|
||||||
let config = &self.config;
|
let config = &self.config;
|
||||||
|
|
|
@ -803,6 +803,7 @@ impl Graph {
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"target": "esnext",
|
"target": "esnext",
|
||||||
"tsBuildInfoFile": "deno:///.tsbuildinfo",
|
"tsBuildInfoFile": "deno:///.tsbuildinfo",
|
||||||
|
"useDefineForClassFields": true,
|
||||||
}));
|
}));
|
||||||
if options.emit {
|
if options.emit {
|
||||||
config.merge(&json!({
|
config.merge(&json!({
|
||||||
|
@ -948,6 +949,7 @@ impl Graph {
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"target": "esnext",
|
"target": "esnext",
|
||||||
|
"useDefineForClassFields": true,
|
||||||
}));
|
}));
|
||||||
let opts = match options.bundle_type {
|
let opts = match options.bundle_type {
|
||||||
BundleType::Esm | BundleType::Iife => json!({
|
BundleType::Esm | BundleType::Iife => json!({
|
||||||
|
|
4
cli/tests/091_use_define_for_class_fields.ts
Normal file
4
cli/tests/091_use_define_for_class_fields.ts
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
class A {
|
||||||
|
b = this.a;
|
||||||
|
constructor(public a: unknown) {}
|
||||||
|
}
|
4
cli/tests/091_use_define_for_class_fields.ts.out
Normal file
4
cli/tests/091_use_define_for_class_fields.ts.out
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
[WILDCARD]error: TS2729 [ERROR]: Property 'a' is used before its initialization.
|
||||||
|
b = this.a;
|
||||||
|
^
|
||||||
|
[WILDCARD]
|
|
@ -9,11 +9,9 @@ function d() {
|
||||||
return Object.assign(promise, methods);
|
return Object.assign(promise, methods);
|
||||||
}
|
}
|
||||||
class A {
|
class A {
|
||||||
|
s = d();
|
||||||
a() {
|
a() {
|
||||||
this.s.resolve();
|
this.s.resolve();
|
||||||
}
|
}
|
||||||
constructor(){
|
|
||||||
this.s = d();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
new A();
|
new A();
|
||||||
|
|
|
@ -2867,6 +2867,12 @@ console.log("finish");
|
||||||
util::test_pty(args, output, input);
|
util::test_pty(args, output, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
itest!(_091_use_define_for_class_fields {
|
||||||
|
args: "run 091_use_define_for_class_fields.ts",
|
||||||
|
output: "091_use_define_for_class_fields.ts.out",
|
||||||
|
exit_code: 1,
|
||||||
|
});
|
||||||
|
|
||||||
itest!(js_import_detect {
|
itest!(js_import_detect {
|
||||||
args: "run --quiet --reload js_import_detect.ts",
|
args: "run --quiet --reload js_import_detect.ts",
|
||||||
output: "js_import_detect.ts.out",
|
output: "js_import_detect.ts.out",
|
||||||
|
|
|
@ -128,6 +128,7 @@ pub const IGNORED_RUNTIME_COMPILER_OPTIONS: &[&str] = &[
|
||||||
"traceResolution",
|
"traceResolution",
|
||||||
"tsBuildInfoFile",
|
"tsBuildInfoFile",
|
||||||
"typeRoots",
|
"typeRoots",
|
||||||
|
"useDefineForClassFields",
|
||||||
"version",
|
"version",
|
||||||
"watch",
|
"watch",
|
||||||
];
|
];
|
||||||
|
|
Loading…
Add table
Reference in a new issue