File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -407,18 +407,17 @@ namespace ts {
407
407
// directory: /a/b/c/d/e
408
408
// resolvedFileName: /a/b/foo.d.ts
409
409
const commonPrefix = getCommonPrefix ( path , resolvedFileName ) ;
410
+ if ( commonPrefix === undefined ) {
411
+ return ;
412
+ }
410
413
let current = path ;
411
- while ( true ) {
414
+ while ( current !== commonPrefix ) {
412
415
const parent = getDirectoryPath ( current ) ;
413
416
if ( parent === current || directoryPathMap . has ( parent ) ) {
414
417
break ;
415
418
}
416
419
directoryPathMap . set ( parent , result ) ;
417
420
current = parent ;
418
-
419
- if ( current === commonPrefix ) {
420
- break ;
421
- }
422
421
}
423
422
}
424
423
@@ -434,6 +433,10 @@ namespace ts {
434
433
i ++ ;
435
434
}
436
435
436
+ if ( i === directory . length && resolutionDirectory . length > i && resolutionDirectory [ i ] === directorySeparator ) {
437
+ return directory ;
438
+ }
439
+
437
440
// find last directory separator before position i
438
441
const sep = directory . lastIndexOf ( directorySeparator , i ) ;
439
442
if ( sep < 0 ) {
You can’t perform that action at this time.
0 commit comments