From 12578a5cc6f2d9542bea1f3f47c8475d8c1d129a Mon Sep 17 00:00:00 2001 From: zhengbli Date: Thu, 22 Sep 2016 14:55:58 -0700 Subject: [PATCH] set allowSyntheticDefaultImports to true by default for jsconfig.json --- src/compiler/commandLineParser.ts | 4 +++- src/harness/unittests/convertCompilerOptionsFromJson.ts | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 90c4d18289a..825519bfb05 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -901,7 +901,9 @@ namespace ts { function convertCompilerOptionsFromJsonWorker(jsonOptions: any, basePath: string, errors: Diagnostic[], configFileName?: string): CompilerOptions { - const options: CompilerOptions = getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: true, maxNodeModuleJsDepth: 2 } : {}; + const options: CompilerOptions = getBaseFileName(configFileName) === "jsconfig.json" + ? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true } + : {}; convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, options, Diagnostics.Unknown_compiler_option_0, errors); return options; } diff --git a/src/harness/unittests/convertCompilerOptionsFromJson.ts b/src/harness/unittests/convertCompilerOptionsFromJson.ts index 9de18850477..73ee8669adb 100644 --- a/src/harness/unittests/convertCompilerOptionsFromJson.ts +++ b/src/harness/unittests/convertCompilerOptionsFromJson.ts @@ -404,6 +404,7 @@ namespace ts { compilerOptions: { allowJs: true, maxNodeModuleJsDepth: 2, + allowSyntheticDefaultImports: true, module: ModuleKind.CommonJS, target: ScriptTarget.ES5, noImplicitAny: false, @@ -431,6 +432,7 @@ namespace ts { compilerOptions: { allowJs: false, maxNodeModuleJsDepth: 2, + allowSyntheticDefaultImports: true, module: ModuleKind.CommonJS, target: ScriptTarget.ES5, noImplicitAny: false, @@ -453,7 +455,8 @@ namespace ts { compilerOptions: { allowJs: true, - maxNodeModuleJsDepth: 2 + maxNodeModuleJsDepth: 2, + allowSyntheticDefaultImports: true }, errors: [{ file: undefined, @@ -473,7 +476,8 @@ namespace ts { compilerOptions: { allowJs: true, - maxNodeModuleJsDepth: 2 + maxNodeModuleJsDepth: 2, + allowSyntheticDefaultImports: true }, errors: [] }