@@ -168,22 +168,19 @@ namespace ts {
168
168
169
169
const typeReferenceExtensions = [ ".d.ts" ] ;
170
170
171
- function getEffectiveTypeRoots ( options : CompilerOptions , host : ModuleResolutionHost ) {
171
+ export function getEffectiveTypeRoots ( options : CompilerOptions , currentDirectory : string ) {
172
172
if ( options . typeRoots ) {
173
173
return options . typeRoots ;
174
174
}
175
175
176
- let currentDirectory : string ;
177
176
if ( options . configFilePath ) {
178
177
currentDirectory = getDirectoryPath ( options . configFilePath ) ;
179
178
}
180
- else if ( host . getCurrentDirectory ) {
181
- currentDirectory = host . getCurrentDirectory ( ) ;
182
- }
183
179
184
180
if ( ! currentDirectory ) {
185
181
return undefined ;
186
182
}
183
+
187
184
return map ( defaultTypeRoots , d => combinePaths ( currentDirectory , d ) ) ;
188
185
}
189
186
@@ -201,7 +198,7 @@ namespace ts {
201
198
traceEnabled
202
199
} ;
203
200
204
- const typeRoots = getEffectiveTypeRoots ( options , host ) ;
201
+ const typeRoots = getEffectiveTypeRoots ( options , host . getCurrentDirectory && host . getCurrentDirectory ( ) ) ;
205
202
if ( traceEnabled ) {
206
203
if ( containingFile === undefined ) {
207
204
if ( typeRoots === undefined ) {
@@ -1061,7 +1058,7 @@ namespace ts {
1061
1058
// Walk the primary type lookup locations
1062
1059
const result : string [ ] = [ ] ;
1063
1060
if ( host . directoryExists && host . getDirectories ) {
1064
- const typeRoots = getEffectiveTypeRoots ( options , host ) ;
1061
+ const typeRoots = getEffectiveTypeRoots ( options , host . getCurrentDirectory && host . getCurrentDirectory ( ) ) ;
1065
1062
if ( typeRoots ) {
1066
1063
for ( const root of typeRoots ) {
1067
1064
if ( host . directoryExists ( root ) ) {
0 commit comments