Skip to content

Commit d2d0f86

Browse files
Merge pull request #20374 from uniqueiniquity/symlinkTypeReferenceDirective
Handle failure to properly resolve type reference directives
2 parents 5af72b5 + 4a87789 commit d2d0f86

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25929,7 +25929,7 @@ namespace ts {
2592925929
// populate reverse mapping: file path -> type reference directive that was resolved to this file
2593025930
fileToDirective = createMap<string>();
2593125931
resolvedTypeReferenceDirectives.forEach((resolvedDirective, key) => {
25932-
if (!resolvedDirective) {
25932+
if (!resolvedDirective || !resolvedDirective.resolvedFileName) {
2593325933
return;
2593425934
}
2593525935
const file = host.getSourceFile(resolvedDirective.resolvedFileName);

src/compiler/moduleNameResolver.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,7 @@ namespace ts {
794794
if (traceEnabled) {
795795
trace(host, Diagnostics.Resolving_real_path_for_0_result_1, path, real);
796796
}
797+
Debug.assert(host.fileExists(real), `${path} linked to nonexistent file ${real}`); // tslint:disable-line
797798
return real;
798799
}
799800

src/compiler/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2779,7 +2779,7 @@ namespace ts {
27792779
getCompilerOptions(): CompilerOptions;
27802780

27812781
getSourceFiles(): ReadonlyArray<SourceFile>;
2782-
getSourceFile(fileName: string): SourceFile;
2782+
getSourceFile(fileName: string): SourceFile | undefined;
27832783
getResolvedTypeReferenceDirectives(): ReadonlyMap<ResolvedTypeReferenceDirective>;
27842784
}
27852785

0 commit comments

Comments
 (0)