Skip to content

Commit 6702e65

Browse files
committed
CR changes
1 parent e8ac1ab commit 6702e65

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

src/compiler/program.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,9 @@ namespace ts {
10311031
// Walk the primary type lookup locations
10321032
let result: string[] = [];
10331033
if (host.directoryExists && host.getDirectories) {
1034-
for (const root of options.typeRoots || defaultTypeRoots) {
1034+
const typeRoots = options.typeRoots ||
1035+
defaultTypeRoots.map(d => combinePaths(options.configFilePath ? getDirectoryPath(options.configFilePath) : host.getCurrentDirectory(), d));
1036+
for (const root of typeRoots) {
10351037
if (host.directoryExists(root)) {
10361038
result = result.concat(host.getDirectories(root));
10371039
}

tests/baselines/reference/typingsLookup1.trace.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,21 @@
1414
"File '/node_modules/@types/jquery/package.json' does not exist.",
1515
"File '/node_modules/@types/jquery/index.ts' does not exist.",
1616
"File '/node_modules/@types/jquery/index.d.ts' exist - use it as a name resolution result.",
17+
"======== Type reference directive 'jquery' was successfully resolved to '/node_modules/@types/jquery/index.d.ts', primary: false. ========",
18+
"======== Resolving type reference directive 'jquery', containing file '/__inferred type names__.ts', root directory 'node_modules/@types'. ========",
19+
"Resolving with primary search path 'node_modules/@types'",
20+
"File 'node_modules/@types/jquery/package.json' does not exist.",
21+
"File 'node_modules/@types/jquery/index.d.ts' does not exist.",
22+
"Looking up in 'node_modules' folder, initial location '/'",
23+
"File '/node_modules/jquery.ts' does not exist.",
24+
"File '/node_modules/jquery.d.ts' does not exist.",
25+
"File '/node_modules/jquery/package.json' does not exist.",
26+
"File '/node_modules/jquery/index.ts' does not exist.",
27+
"File '/node_modules/jquery/index.d.ts' does not exist.",
28+
"File '/node_modules/@types/jquery.ts' does not exist.",
29+
"File '/node_modules/@types/jquery.d.ts' does not exist.",
30+
"File '/node_modules/@types/jquery/package.json' does not exist.",
31+
"File '/node_modules/@types/jquery/index.ts' does not exist.",
32+
"File '/node_modules/@types/jquery/index.d.ts' exist - use it as a name resolution result.",
1733
"======== Type reference directive 'jquery' was successfully resolved to '/node_modules/@types/jquery/index.d.ts', primary: false. ========"
1834
]

tests/cases/conformance/references/library-reference-6.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,4 @@ var x: string = alpha.a;
1313

1414
// @filename: /tsconfig.json
1515
{
16-
"compilerOptions": {
17-
"typesRoot": "types"
18-
}
1916
}

0 commit comments

Comments
 (0)