(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason)
| 118473 | ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop(); |
| 118474 | } |
| 118475 | function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason) { |
| 118476 | // If we already found this library as a primary reference - nothing to do |
| 118477 | var previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective, mode); |
| 118478 | if (previousResolution && previousResolution.primary) { |
| 118479 | return; |
| 118480 | } |
| 118481 | var saveResolution = true; |
| 118482 | if (resolvedTypeReferenceDirective) { |
| 118483 | if (resolvedTypeReferenceDirective.isExternalLibraryImport) |
| 118484 | currentNodeModulesDepth++; |
| 118485 | if (resolvedTypeReferenceDirective.primary) { |
| 118486 | // resolved from the primary path |
| 118487 | processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, resolvedTypeReferenceDirective.packageId, reason); // TODO: GH#18217 |
| 118488 | } |
| 118489 | else { |
| 118490 | // If we already resolved to this file, it must have been a secondary reference. Check file contents |
| 118491 | // for sameness and possibly issue an error |
| 118492 | if (previousResolution) { |
| 118493 | // Don't bother reading the file again if it's the same file. |
| 118494 | if (resolvedTypeReferenceDirective.resolvedFileName !== previousResolution.resolvedFileName) { |
| 118495 | var otherFileText = host.readFile(resolvedTypeReferenceDirective.resolvedFileName); |
| 118496 | var existingFile = getSourceFile(previousResolution.resolvedFileName); |
| 118497 | if (otherFileText !== existingFile.text) { |
| 118498 | addFilePreprocessingFileExplainingDiagnostic(existingFile, reason, ts.Diagnostics.Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict, [typeReferenceDirective, resolvedTypeReferenceDirective.resolvedFileName, previousResolution.resolvedFileName]); |
| 118499 | } |
| 118500 | } |
| 118501 | // don't overwrite previous resolution result |
| 118502 | saveResolution = false; |
| 118503 | } |
| 118504 | else { |
| 118505 | // First resolution of this library |
| 118506 | processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, resolvedTypeReferenceDirective.packageId, reason); |
| 118507 | } |
| 118508 | } |
| 118509 | if (resolvedTypeReferenceDirective.isExternalLibraryImport) |
| 118510 | currentNodeModulesDepth--; |
| 118511 | } |
| 118512 | else { |
| 118513 | addFilePreprocessingFileExplainingDiagnostic(/*file*/ undefined, reason, ts.Diagnostics.Cannot_find_type_definition_file_for_0, [typeReferenceDirective]); |
| 118514 | } |
| 118515 | if (saveResolution) { |
| 118516 | resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode, resolvedTypeReferenceDirective); |
| 118517 | } |
| 118518 | } |
| 118519 | function pathForLibFile(libFileName) { |
| 118520 | // Support resolving to lib.dom.d.ts -> @typescript/lib-dom, and |
| 118521 | // lib.dom.iterable.d.ts -> @typescript/lib-dom/iterable |
no test coverage detected
searching dependent graphs…