@@ -295,19 +295,21 @@ function triggerIncrementalCompilationOfFile(
295295 INCREMENTAL_FILE_FOLDER_LOCATION ,
296296 ) as NormalizedPath ;
297297
298- // projectRootPath is already NormalizedPath, appending a constant string still makes it a NormalizedPath
299- let originalTypeFileLocation = path . resolve (
298+ const relSourcePath = path . relative ( projectRootPath , filePath ) ;
299+ const relSourceDir = path . dirname ( relSourcePath ) ;
300+ const typeExt = ext === ".res" ? ".cmt" : ".cmti" ;
301+ const originalTypeFileName =
302+ project . namespaceName != null
303+ ? `${ moduleName } -${ project . namespaceName } ${ typeExt } `
304+ : `${ moduleName } ${ typeExt } ` ;
305+ // projectRootPath is already NormalizedPath, appending constant strings still yields a NormalizedPath
306+ const originalTypeFileLocation = path . resolve (
300307 projectRootPath ,
301308 c . compilerDirPartialPath ,
302- path . relative ( projectRootPath , filePath ) ,
309+ relSourceDir ,
310+ originalTypeFileName ,
303311 ) as NormalizedPath ;
304312
305- const parsed = path . parse ( originalTypeFileLocation ) ;
306- parsed . ext = ext === ".res" ? ".cmt" : ".cmti" ;
307- parsed . base = "" ;
308- // As originalTypeFileLocation was a NormalizedPath, path.format ensures we can assume string is now NormalizedPath
309- originalTypeFileLocation = path . format ( parsed ) as NormalizedPath ;
310-
311313 incrementalFileCacheEntry = {
312314 file : {
313315 originalTypeFileLocation,
0 commit comments