Allow references to ambient block scoped variables

Even when
1. --out or --outfile is specified
2. The block scoped variable's file is after the referrer's file.
This commit is contained in:
Nathan Shively-Sanders
2017-05-11 11:37:28 -07:00
parent 066bb16173
commit e76c96ce54

View File

@@ -737,7 +737,8 @@ namespace ts {
const useFile = getSourceFileOfNode(usage);
if (declarationFile !== useFile) {
if ((modulekind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator)) ||
(!compilerOptions.outFile && !compilerOptions.out)) {
(!compilerOptions.outFile && !compilerOptions.out) ||
isInAmbientContext(declaration)) {
// nodes are in different files and order cannot be determined
return true;
}