fix(compiler-cli): do not force type checking on .js files

The compiler host would force any file that is in node_modules
into the list of files that needed to be type checked which
captures .js files if `allowJs` is set to `true`. This should
have only forced .d.ts files into the project to enable
generation of factories.

Fixes: #19757
This commit is contained in:
Chuck Jazdzewski
2017-12-15 14:51:42 -08:00
committed by Alex Rickabaugh
parent 30208759cd
commit 5f23a1223f
2 changed files with 33 additions and 1 deletions

View File

@ -130,7 +130,7 @@ export class TsCompilerAotCompilerTypeCheckHostAdapter implements ts.CompilerHos
moduleName, containingFile.replace(/\\/g, '/'), this.options, this,
this.moduleResolutionCache)
.resolvedModule;
if (rm && this.isSourceFile(rm.resolvedFileName)) {
if (rm && this.isSourceFile(rm.resolvedFileName) && DTS.test(rm.resolvedFileName)) {
// Case: generateCodeForLibraries = true and moduleName is
// a .d.ts file in a node_modules folder.
// Need to set isExternalLibraryImport to false so that generated files for that file