From 34418884f4b57c925d3627c194482750e858ff63 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Thu, 14 Oct 2021 21:13:15 +1100 Subject: [PATCH] fix(cli): re-enable allowSyntheticDefaultImports for tsc (#12435) Fixes #12434 --- cli/emit.rs | 2 ++ cli/tests/testdata/compiler_api_test.ts | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/cli/emit.rs b/cli/emit.rs index 5a1cf61d16..472648bca4 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 b743a8612b..914147f76d 100644 --- a/cli/tests/testdata/compiler_api_test.ts +++ b/cli/tests/testdata/compiler_api_test.ts @@ -177,6 +177,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": + `///