Skip to content

Commit 25e9226

Browse files
committed
addressed PR feedback
1 parent a4f30ff commit 25e9226

4 files changed

Lines changed: 3 additions & 21 deletions

File tree

src/compiler/program.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,7 @@ namespace ts {
237237
}
238238

239239
function getEffectiveTypesPrimarySearchPaths(options: CompilerOptions): string[] {
240-
if (options.typesSearchPaths) {
241-
return options.typesSearchPaths;
242-
}
243-
return options.configFilePath
244-
? [getDirectoryPath(options.configFilePath)].concat(defaultLibrarySearchPaths)
245-
: defaultLibrarySearchPaths;
240+
return options.typesSearchPaths || defaultLibrarySearchPaths;
246241
}
247242

248243
export function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string, compilationRoot: string, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations {
@@ -1767,9 +1762,9 @@ namespace ts {
17671762
const resolvedTypeReferenceDirective = resolutions[i];
17681763
// store resolved type directive on the file
17691764
setResolvedTypeReferenceDirective(file, ref.fileName, resolvedTypeReferenceDirective);
1770-
// If we already found this library as a primary reference, or failed to find it, nothing to do
1765+
// If we already found this library as a primary reference - nothing to do
17711766
const previousResolution = resolvedTypeReferenceDirectives[ref.fileName];
1772-
if (previousResolution && (previousResolution.primary || (previousResolution.resolvedFileName === undefined))) {
1767+
if (previousResolution && previousResolution.primary) {
17731768
continue;
17741769
}
17751770
let saveResolution = true;

src/compiler/types.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2750,13 +2750,6 @@ namespace ts {
27502750
isExternalLibraryImport?: boolean;
27512751
}
27522752

2753-
export interface ResolvedLibrary {
2754-
// True if the library was found in a primary lookup location
2755-
primary: boolean;
2756-
// The location of the .d.ts file we located, or undefined if resolution failed
2757-
resolvedFileName?: string;
2758-
}
2759-
27602753
export interface ResolvedModuleWithFailedLookupLocations {
27612754
resolvedModule: ResolvedModule;
27622755
failedLookupLocations: string[];

tests/baselines/reference/library-reference-6.trace.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
[
22
"======== Resolving type reference directive 'alpha' from '/src/foo.ts' with compilation root dir '/'. ========",
3-
"Resolving with primary search path '/'",
4-
"File '/alpha/package.json' does not exist.",
5-
"File '/alpha/index.d.ts' does not exist.",
63
"Resolving with primary search path '/types/'",
74
"File '/types/alpha/package.json' does not exist.",
85
"File '/types/alpha/index.d.ts' exist - use it as a name resolution result.",

tests/baselines/reference/library-reference-7.trace.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
[
22
"======== Resolving type reference directive 'alpha' from '/base/src/foo.ts' with compilation root dir '/base'. ========",
3-
"Resolving with primary search path '/'",
4-
"File '/alpha/package.json' does not exist.",
5-
"File '/alpha/index.d.ts' does not exist.",
63
"Resolving with primary search path '/base/types/'",
74
"File '/base/types/alpha/package.json' does not exist.",
85
"File '/base/types/alpha/index.d.ts' exist - use it as a name resolution result.",

0 commit comments

Comments
 (0)