addressed PR feedback

This commit is contained in:
Vladimir Matveev
2016-04-04 18:03:36 -07:00
parent a4f30ff2a7
commit 25e9226d25
4 changed files with 3 additions and 21 deletions

View File

@@ -237,12 +237,7 @@ namespace ts {
}
function getEffectiveTypesPrimarySearchPaths(options: CompilerOptions): string[] {
if (options.typesSearchPaths) {
return options.typesSearchPaths;
}
return options.configFilePath
? [getDirectoryPath(options.configFilePath)].concat(defaultLibrarySearchPaths)
: defaultLibrarySearchPaths;
return options.typesSearchPaths || defaultLibrarySearchPaths;
}
export function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string, compilationRoot: string, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations {
@@ -1767,9 +1762,9 @@ namespace ts {
const resolvedTypeReferenceDirective = resolutions[i];
// store resolved type directive on the file
setResolvedTypeReferenceDirective(file, ref.fileName, resolvedTypeReferenceDirective);
// If we already found this library as a primary reference, or failed to find it, nothing to do
// If we already found this library as a primary reference - nothing to do
const previousResolution = resolvedTypeReferenceDirectives[ref.fileName];
if (previousResolution && (previousResolution.primary || (previousResolution.resolvedFileName === undefined))) {
if (previousResolution && previousResolution.primary) {
continue;
}
let saveResolution = true;

View File

@@ -2750,13 +2750,6 @@ namespace ts {
isExternalLibraryImport?: boolean;
}
export interface ResolvedLibrary {
// True if the library was found in a primary lookup location
primary: boolean;
// The location of the .d.ts file we located, or undefined if resolution failed
resolvedFileName?: string;
}
export interface ResolvedModuleWithFailedLookupLocations {
resolvedModule: ResolvedModule;
failedLookupLocations: string[];

View File

@@ -1,8 +1,5 @@
[
"======== Resolving type reference directive 'alpha' from '/src/foo.ts' with compilation root dir '/'. ========",
"Resolving with primary search path '/'",
"File '/alpha/package.json' does not exist.",
"File '/alpha/index.d.ts' does not exist.",
"Resolving with primary search path '/types/'",
"File '/types/alpha/package.json' does not exist.",
"File '/types/alpha/index.d.ts' exist - use it as a name resolution result.",

View File

@@ -1,8 +1,5 @@
[
"======== Resolving type reference directive 'alpha' from '/base/src/foo.ts' with compilation root dir '/base'. ========",
"Resolving with primary search path '/'",
"File '/alpha/package.json' does not exist.",
"File '/alpha/index.d.ts' does not exist.",
"Resolving with primary search path '/base/types/'",
"File '/base/types/alpha/package.json' does not exist.",
"File '/base/types/alpha/index.d.ts' exist - use it as a name resolution result.",