From 6702e651a3e6de28a9a751d2c4282494412a0081 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Mon, 13 Jun 2016 10:15:29 -0700 Subject: [PATCH] CR changes --- src/compiler/program.ts | 4 +++- .../reference/typingsLookup1.trace.json | 16 ++++++++++++++++ .../references/library-reference-6.ts | 3 --- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 9cb000a4d61..59ae0d862ad 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1031,7 +1031,9 @@ namespace ts { // Walk the primary type lookup locations let result: string[] = []; if (host.directoryExists && host.getDirectories) { - for (const root of options.typeRoots || defaultTypeRoots) { + const typeRoots = options.typeRoots || + defaultTypeRoots.map(d => combinePaths(options.configFilePath ? getDirectoryPath(options.configFilePath) : host.getCurrentDirectory(), d)); + for (const root of typeRoots) { if (host.directoryExists(root)) { result = result.concat(host.getDirectories(root)); } diff --git a/tests/baselines/reference/typingsLookup1.trace.json b/tests/baselines/reference/typingsLookup1.trace.json index 0463c920bd3..ad0354157c3 100644 --- a/tests/baselines/reference/typingsLookup1.trace.json +++ b/tests/baselines/reference/typingsLookup1.trace.json @@ -14,5 +14,21 @@ "File '/node_modules/@types/jquery/package.json' does not exist.", "File '/node_modules/@types/jquery/index.ts' does not exist.", "File '/node_modules/@types/jquery/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'jquery' was successfully resolved to '/node_modules/@types/jquery/index.d.ts', primary: false. ========", + "======== Resolving type reference directive 'jquery', containing file '/__inferred type names__.ts', root directory 'node_modules/@types'. ========", + "Resolving with primary search path 'node_modules/@types'", + "File 'node_modules/@types/jquery/package.json' does not exist.", + "File 'node_modules/@types/jquery/index.d.ts' does not exist.", + "Looking up in 'node_modules' folder, initial location '/'", + "File '/node_modules/jquery.ts' does not exist.", + "File '/node_modules/jquery.d.ts' does not exist.", + "File '/node_modules/jquery/package.json' does not exist.", + "File '/node_modules/jquery/index.ts' does not exist.", + "File '/node_modules/jquery/index.d.ts' does not exist.", + "File '/node_modules/@types/jquery.ts' does not exist.", + "File '/node_modules/@types/jquery.d.ts' does not exist.", + "File '/node_modules/@types/jquery/package.json' does not exist.", + "File '/node_modules/@types/jquery/index.ts' does not exist.", + "File '/node_modules/@types/jquery/index.d.ts' exist - use it as a name resolution result.", "======== Type reference directive 'jquery' was successfully resolved to '/node_modules/@types/jquery/index.d.ts', primary: false. ========" ] \ No newline at end of file diff --git a/tests/cases/conformance/references/library-reference-6.ts b/tests/cases/conformance/references/library-reference-6.ts index 765a6760aa4..13ad382e636 100644 --- a/tests/cases/conformance/references/library-reference-6.ts +++ b/tests/cases/conformance/references/library-reference-6.ts @@ -13,7 +13,4 @@ var x: string = alpha.a; // @filename: /tsconfig.json { - "compilerOptions": { - "typesRoot": "types" - } }