Get dts content from sourceFile if present

This commit is contained in:
Sheetal Nandi
2019-01-24 13:47:27 -08:00
parent 50d98aee0e
commit 216ed1b385
2 changed files with 31 additions and 28 deletions

View File

@@ -1457,7 +1457,11 @@ namespace ts {
if (!out) continue;
const { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath } = getOutputPathsForBundle(resolvedRefOpts.options, /*forceDtsPaths*/ true);
const node = createInputFiles(path => host.readFile(path), jsFilePath!, sourceMapFilePath, declarationFilePath!, declarationMapPath);
const node = createInputFiles(fileName => {
const path = toPath(fileName);
const sourceFile = getSourceFileByPath(path);
return sourceFile ? sourceFile.text : filesByName.has(path) ? undefined : host.readFile(path);
}, jsFilePath! , sourceMapFilePath, declarationFilePath! , declarationMapPath);
nodes.push(node);
}
}