@@ -205,7 +205,9 @@ namespace ts {
205
205
}
206
206
207
207
export function typeDirectiveIsEqualTo ( oldResolution : ResolvedTypeReferenceDirective , newResolution : ResolvedTypeReferenceDirective ) : boolean {
208
- return oldResolution . resolvedFileName === newResolution . resolvedFileName && oldResolution . primary === newResolution . primary ;
208
+ return oldResolution . resolvedFileName === newResolution . resolvedFileName
209
+ && oldResolution . primary === newResolution . primary
210
+ && oldResolution . originalPath === newResolution . originalPath ;
209
211
}
210
212
211
213
export function hasChangesInResolutions < T > (
@@ -6149,6 +6151,8 @@ namespace ts {
6149
6151
getSymlinkedFiles ( ) : ReadonlyESMap < Path , string > | undefined ;
6150
6152
setSymlinkedDirectory ( symlink : string , real : SymlinkedDirectory | false ) : void ;
6151
6153
setSymlinkedFile ( symlinkPath : Path , real : string ) : void ;
6154
+ /*@internal */
6155
+ setSymlinkedDirectoryFromSymlinkedFile ( symlink : string , real : string ) : void ;
6152
6156
}
6153
6157
6154
6158
export function createSymlinkCache ( cwd : string , getCanonicalFileName : GetCanonicalFileName ) : SymlinkCache {
@@ -6172,16 +6176,31 @@ namespace ts {
6172
6176
}
6173
6177
( symlinkedDirectories || ( symlinkedDirectories = new Map ( ) ) ) . set ( symlinkPath , real ) ;
6174
6178
}
6175
- }
6179
+ } ,
6180
+ setSymlinkedDirectoryFromSymlinkedFile ( symlink , real ) {
6181
+ this . setSymlinkedFile ( toPath ( symlink , cwd , getCanonicalFileName ) , real ) ;
6182
+ const [ commonResolved , commonOriginal ] = guessDirectorySymlink ( real , symlink , cwd , getCanonicalFileName ) || emptyArray ;
6183
+ if ( commonResolved && commonOriginal ) {
6184
+ this . setSymlinkedDirectory ( commonOriginal , {
6185
+ real : commonResolved ,
6186
+ realPath : toPath ( commonResolved , cwd , getCanonicalFileName ) ,
6187
+ } ) ;
6188
+ }
6189
+ } ,
6176
6190
} ;
6177
6191
}
6178
6192
6179
6193
export function discoverProbableSymlinks ( files : readonly SourceFile [ ] , getCanonicalFileName : GetCanonicalFileName , cwd : string ) : SymlinkCache {
6180
6194
const cache = createSymlinkCache ( cwd , getCanonicalFileName ) ;
6181
- const symlinks = flatten < readonly [ string , string ] > ( mapDefined ( files , sf =>
6182
- sf . resolvedModules && compact ( arrayFrom ( mapIterator ( sf . resolvedModules . values ( ) , res =>
6183
- res && res . originalPath && res . resolvedFileName !== res . originalPath ? [ res . resolvedFileName , res . originalPath ] as const : undefined ) ) ) ) ) ;
6195
+ const symlinks = flatMap ( files , sf => {
6196
+ const pairs = sf . resolvedModules && arrayFrom ( mapDefinedIterator ( sf . resolvedModules . values ( ) , res =>
6197
+ res ?. originalPath ? [ res . resolvedFileName , res . originalPath ] as const : undefined ) ) ;
6198
+ return concatenate ( pairs , sf . resolvedTypeReferenceDirectiveNames && arrayFrom ( mapDefinedIterator ( sf . resolvedTypeReferenceDirectiveNames . values ( ) , res =>
6199
+ res ?. originalPath && res . resolvedFileName ? [ res . resolvedFileName , res . originalPath ] as const : undefined ) ) ) ;
6200
+ } ) ;
6201
+
6184
6202
for ( const [ resolvedPath , originalPath ] of symlinks ) {
6203
+ cache . setSymlinkedFile ( toPath ( originalPath , cwd , getCanonicalFileName ) , resolvedPath ) ;
6185
6204
const [ commonResolved , commonOriginal ] = guessDirectorySymlink ( resolvedPath , originalPath , cwd , getCanonicalFileName ) || emptyArray ;
6186
6205
if ( commonResolved && commonOriginal ) {
6187
6206
cache . setSymlinkedDirectory (
0 commit comments