Merge pull request #20374 from uniqueiniquity/symlinkTypeReferenceDirective

Handle failure to properly resolve type reference directives
This commit is contained in:
Benjamin Lichtman 2018-03-29 15:26:30 -07:00 committed by GitHub
commit d2d0f86831
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

View File

@ -25929,7 +25929,7 @@ namespace ts {
// populate reverse mapping: file path -> type reference directive that was resolved to this file
fileToDirective = createMap<string>();
resolvedTypeReferenceDirectives.forEach((resolvedDirective, key) => {
if (!resolvedDirective) {
if (!resolvedDirective || !resolvedDirective.resolvedFileName) {
return;
}
const file = host.getSourceFile(resolvedDirective.resolvedFileName);

View File

@ -794,6 +794,7 @@ namespace ts {
if (traceEnabled) {
trace(host, Diagnostics.Resolving_real_path_for_0_result_1, path, real);
}
Debug.assert(host.fileExists(real), `${path} linked to nonexistent file ${real}`); // tslint:disable-line
return real;
}

View File

@ -2779,7 +2779,7 @@ namespace ts {
getCompilerOptions(): CompilerOptions;
getSourceFiles(): ReadonlyArray<SourceFile>;
getSourceFile(fileName: string): SourceFile;
getSourceFile(fileName: string): SourceFile | undefined;
getResolvedTypeReferenceDirectives(): ReadonlyMap<ResolvedTypeReferenceDirective>;
}