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: [] }