mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
fix(cli/module_graph): Set useDefineForClassFields to true (#9774)
Fixes #9773
This commit is contained in:
parent
7286eea75c
commit
c4709834b3
6 changed files with 18 additions and 0 deletions
|
@ -314,6 +314,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;
|
||||||
|
|
|
@ -809,6 +809,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!({
|
||||||
|
@ -954,6 +955,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/088_use_define_for_class_fields.ts
Normal file
4
cli/tests/088_use_define_for_class_fields.ts
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
class A {
|
||||||
|
b = this.a;
|
||||||
|
constructor(public a: unknown) {}
|
||||||
|
}
|
4
cli/tests/088_use_define_for_class_fields.ts.out
Normal file
4
cli/tests/088_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]
|
|
@ -2841,6 +2841,12 @@ console.log("finish");
|
||||||
output: "087_no_check_imports_not_used_as_values.ts.out",
|
output: "087_no_check_imports_not_used_as_values.ts.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
itest!(_088_use_define_for_class_fields {
|
||||||
|
args: "run 088_use_define_for_class_fields.ts",
|
||||||
|
output: "088_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",
|
||||||
|
|
|
@ -130,6 +130,7 @@ pub const IGNORED_RUNTIME_COMPILER_OPTIONS: &[&str] = &[
|
||||||
"traceResolution",
|
"traceResolution",
|
||||||
"tsBuildInfoFile",
|
"tsBuildInfoFile",
|
||||||
"typeRoots",
|
"typeRoots",
|
||||||
|
"useDefineForClassFields",
|
||||||
"version",
|
"version",
|
||||||
"watch",
|
"watch",
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue