summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/emit.rs2
-rw-r--r--cli/tests/testdata/compiler_api_test.ts25
2 files changed, 27 insertions, 0 deletions
diff --git a/cli/emit.rs b/cli/emit.rs
index 5a1cf61d1..472648bca 100644
--- a/cli/emit.rs
+++ b/cli/emit.rs
@@ -149,6 +149,7 @@ pub(crate) fn get_ts_config(
ConfigType::Check { tsc_emit, lib } => {
let mut ts_config = TsConfig::new(json!({
"allowJs": true,
+ "allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"incremental": true,
"jsx": "react",
@@ -193,6 +194,7 @@ pub(crate) fn get_ts_config(
ConfigType::RuntimeEmit { tsc_emit } => {
let mut ts_config = TsConfig::new(json!({
"allowJs": true,
+ "allowSyntheticDefaultImports": true,
"checkJs": false,
"emitDecoratorMetadata": false,
"experimentalDecorators": true,
diff --git a/cli/tests/testdata/compiler_api_test.ts b/cli/tests/testdata/compiler_api_test.ts
index b743a8612..914147f76 100644
--- a/cli/tests/testdata/compiler_api_test.ts
+++ b/cli/tests/testdata/compiler_api_test.ts
@@ -178,6 +178,31 @@ Deno.test({
});
Deno.test({
+ name: "Deno.emit() - allowSyntheticDefaultImports true by default",
+ async fn() {
+ const { diagnostics, files, ignoredOptions } = await Deno.emit(
+ "file:///a.ts",
+ {
+ sources: {
+ "file:///a.ts": `import b from "./b.js";\n`,
+ "file:///b.js":
+ `/// <reference types="./b.d.ts";\n\nconst b = "b";\n\nexport default b;\n`,
+ "file:///b.d.ts": `declare const b: "b";\nexport = b;\n`,
+ },
+ },
+ );
+ assertEquals(diagnostics.length, 0);
+ assert(!ignoredOptions);
+ const keys = Object.keys(files).sort();
+ assertEquals(keys, [
+ "file:///a.ts.js",
+ "file:///a.ts.js.map",
+ "file:///b.js",
+ ]);
+ },
+});
+
+Deno.test({
name: "Deno.emit() - no check",
async fn() {
const { diagnostics, files, ignoredOptions, stats } = await Deno.emit(