diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 861279b2225..82c3eaaf04b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -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; }