Skip to content

Commit 788f2ea

Browse files
johnnyreillyclaude
andcommitted
fix: canonicalize openFiles/fileNotifications casing to match openProjects
Upgrades to typescript@next 7.1.0-dev.20260922.1 and fixes the "no project found for opened file" failure that persisted against it on Windows (see microsoft/TypeScript#64204 (comment) onwards). Per microsoft/TypeScript#64204 (comment) and microsoft/TypeScript#64204 (comment), the failure traces back to a Windows drive-letter casing mismatch. ts-loader was itself contributing to that: `openProjects` always carried `configFilePath`'s resolvedFilePathCache'd (lowercased) form, but `openFiles` and `fileNotifications.changed`/`deleted` used `fileName`'s natural, unmodified casing - so a single snapshot request could mix a lowercase-drive-letter project path with a differently-cased file path. Canonicalizes every file name sent to the API the same way project paths already are, at the single point (`updateSnapshot`) where the wire params are built - doesn't touch how `apiFileName` is used anywhere else (getSourceFile, getConfiguredProject, dependency tracking, etc.), keeping this a narrow, wire-boundary-only change. Confirmed via .github/workflows/windows-test-probe.yml that this fix alone is sufficient - appendSuffixTo and the full 50-suite comparison run both pass on Windows without any additional workaround. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent be6fe5a commit 788f2ea

7 files changed

Lines changed: 69 additions & 133 deletions

File tree

‎.github/workflows/push.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
strategy:
5454
matrix:
5555
node: [26, 24, 22]
56-
ts: [7.1.0-dev.20260919.1, next]
56+
ts: [7.1.0-dev.20260922.1, next]
5757
webpack: [4, 5]
5858
runs-on: ubuntu-latest
5959
steps:
@@ -85,7 +85,7 @@ jobs:
8585
strategy:
8686
matrix:
8787
node: [26, 24, 22]
88-
ts: [7.1.0-dev.20260919.1, next]
88+
ts: [7.1.0-dev.20260922.1, next]
8989
webpack: [4, 5]
9090
runs-on: windows-latest
9191
steps:

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"oxlint-tsgolint": "^7.0.2001",
8888
"prettier": "^3.9.6",
8989
"semver": "^7.8.5",
90-
"typescript": "7.1.0-dev.20260919.1",
90+
"typescript": "next",
9191
"webpack": "^5.74.0",
9292
"webpack-cli": "^4.10.0"
9393
},

‎repro-no-project-found-for-opened-file/real.ts‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎repro-no-project-found-for-opened-file/repro.js‎

Lines changed: 0 additions & 44 deletions
This file was deleted.

‎repro-no-project-found-for-opened-file/tsconfig.json‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎src/typeScriptApi.ts‎

Lines changed: 21 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -621,13 +621,15 @@ function updateSnapshot(
621621
? {
622622
changed: mapApiFacingFileNames(
623623
typeScriptInstance.pendingChangedFiles,
624+
resolvedFilePathCache,
624625
),
625626
deleted: mapApiFacingFileNames(
626627
typeScriptInstance.pendingRemovedFiles,
628+
resolvedFilePathCache,
627629
),
628630
}
629631
: changedFileNames && changedFileNames.size > 0
630-
? { changed: [...changedFileNames] }
632+
? { changed: [...changedFileNames].map(resolvedFilePathCache) }
631633
: undefined;
632634
if (typeScriptInstance.pendingInvalidation) {
633635
// A real rescan can change any file's content, so directImportsCache
@@ -659,51 +661,32 @@ function updateSnapshot(
659661
typeScriptInstance.pendingInvalidation = false;
660662
typeScriptInstance.pendingChangedFiles = undefined;
661663
typeScriptInstance.pendingRemovedFiles = undefined;
664+
// `openProjects`/`closeProjects` are already resolvedFilePathCache'd (see
665+
// `configFilePath` and `ensureSyntheticConfigForFile`) - `fileName` needs
666+
// the same treatment here so every path in a single request shares one
667+
// canonical casing. Without this, `openProjects` could carry a
668+
// lowercased drive letter while `openFiles` keeps `fileName`'s natural
669+
// (e.g. real, uppercase-drive-letter) casing, which is enough on its own
670+
// to make the API unable to find a project for the opened file on
671+
// Windows - see https://github.com/microsoft/TypeScript/pull/64204#issuecomment-5791438694.
672+
const apiFacingFileName = resolvedFilePathCache(fileName);
662673
const params =
663674
openProjects && openProjects.length > 0
664675
? {
665676
openProjects,
666-
openFiles: [fileName],
677+
openFiles: [apiFacingFileName],
667678
fileNotifications,
668679
closeProjects,
669680
}
670-
: { openFiles: [fileName], fileNotifications, closeProjects };
681+
: { openFiles: [apiFacingFileName], fileNotifications, closeProjects };
671682
// The API no longer tracks a "latest snapshot" of its own (see
672683
// https://github.com/microsoft/TypeScript/pull/64204) - ts-loader must
673684
// explicitly layer each new snapshot over the previous one via
674685
// `snapshot.update` to retain its cache, falling back to a fresh
675686
// `createSnapshot` only for the very first snapshot of the instance.
676-
let snapshot;
677-
try {
678-
snapshot = previousSnapshot
679-
? previousSnapshot.update(params)
680-
: typeScriptInstance.api.createSnapshot(params);
681-
} catch (error) {
682-
// `fileName` can be a virtual identity that isn't part of the project
683-
// being opened in this same call (e.g. a webpack entry aliased by
684-
// `appendTsSuffixTo`/`toApiFacingFileName`, not yet on disk under that
685-
// name) - asking to open the project and that file together panics the
686-
// API on Windows ("no project found for opened file") instead of
687-
// falling back to an inferred project, per
688-
// `SnapshotRequestChangesParams.openFiles`'s own doc comment. Retry
689-
// opening just the project, without the file: prepareSnapshotForFile's
690-
// own membership check + synthetic-config fallback (see
691-
// ensureSyntheticConfigForFile) then takes over, exactly as it already
692-
// does for any later never-before-seen file. Only relevant when this
693-
// call was opening a project in the first place - anything else is a
694-
// genuine failure, not this shape of bug.
695-
if (!openProjects || openProjects.length === 0) {
696-
throw error;
697-
}
698-
const paramsWithoutOpenFiles = {
699-
openProjects,
700-
fileNotifications,
701-
closeProjects,
702-
};
703-
snapshot = previousSnapshot
704-
? previousSnapshot.update(paramsWithoutOpenFiles)
705-
: typeScriptInstance.api.createSnapshot(paramsWithoutOpenFiles);
706-
}
687+
const snapshot = previousSnapshot
688+
? previousSnapshot.update(params)
689+
: typeScriptInstance.api.createSnapshot(params);
707690

708691
typeScriptInstance.snapshot = snapshot;
709692
openProjects?.forEach(projectPath =>
@@ -725,11 +708,14 @@ function updateSnapshot(
725708
*/
726709
function mapApiFacingFileNames(
727710
fileNames: ReadonlySet<string> | undefined,
711+
resolvedFilePathCache: ResolvedFilePathCache,
728712
): string[] | undefined {
729713
if (!fileNames || fileNames.size === 0) {
730714
return undefined;
731715
}
732-
return [...fileNames].map(toApiFacingFileName);
716+
return [...fileNames].map(fileName =>
717+
resolvedFilePathCache(toApiFacingFileName(fileName)),
718+
);
733719
}
734720

735721
/**

‎yarn.lock‎

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -486,40 +486,40 @@
486486
dependencies:
487487
"@types/node" "*"
488488

489-
"@typescript/typescript-darwin-arm64@7.1.0-dev.20260919.1":
490-
version "7.1.0-dev.20260919.1"
491-
resolved "https://registry.yarnpkg.com/@typescript/typescript-darwin-arm64/-/typescript-darwin-arm64-7.1.0-dev.20260919.1.tgz#e3e45879583eec82e454069a10b55aef5ae850af"
492-
integrity sha512-gfsw0dd7SfCX3IGXMhf2Zvdoy6xqoqDeAAUVF/NVY8QoxyHUf8aCFotT+VZ5+HzaXfkR/FWIcG3qZadbmtl/Jw==
493-
494-
"@typescript/typescript-darwin-x64@7.1.0-dev.20260919.1":
495-
version "7.1.0-dev.20260919.1"
496-
resolved "https://registry.yarnpkg.com/@typescript/typescript-darwin-x64/-/typescript-darwin-x64-7.1.0-dev.20260919.1.tgz#208465aab5580e5c801eb5f6d404424f6e300e9b"
497-
integrity sha512-hBDblvcjKtW/W5ajIlZ2xgty0RO/MrVgJICHi4zIyMcQufy5zDssURLYDF8dRgJ7vi1k1dO1Ztpylg7TSR+RGw==
498-
499-
"@typescript/typescript-linux-arm64@7.1.0-dev.20260919.1":
500-
version "7.1.0-dev.20260919.1"
501-
resolved "https://registry.yarnpkg.com/@typescript/typescript-linux-arm64/-/typescript-linux-arm64-7.1.0-dev.20260919.1.tgz#617317ea081e33b8b1248f42ab5dfe4c57320058"
502-
integrity sha512-hZlD/eekXNsxhZZfp7svJbQohohBPj46PuWU+i0yAEfcF7EigzryusLZo8Dn6YWaF1gR8NCollmEVkzOxrEnpQ==
503-
504-
"@typescript/typescript-linux-arm@7.1.0-dev.20260919.1":
505-
version "7.1.0-dev.20260919.1"
506-
resolved "https://registry.yarnpkg.com/@typescript/typescript-linux-arm/-/typescript-linux-arm-7.1.0-dev.20260919.1.tgz#987bf13694aaf2d8fffb8bdba08f726a67224cd5"
507-
integrity sha512-hRNyfgyswSs55mor4ZFUusmmDCECVVwpij2rlH+9Dne13Umz6V/+h4p50hlx8nA2oOb5BHZrquooBF0UFnPzgw==
508-
509-
"@typescript/typescript-linux-x64@7.1.0-dev.20260919.1":
510-
version "7.1.0-dev.20260919.1"
511-
resolved "https://registry.yarnpkg.com/@typescript/typescript-linux-x64/-/typescript-linux-x64-7.1.0-dev.20260919.1.tgz#fc2bc07eac57c7af0c40fba7181390c13d7d02ba"
512-
integrity sha512-vwxHgWH7Vbq1yfxaEUD6hFVL2cG0c7i6X3ANNsupVyJpf3X1rRLvfIHk7pQqfZIL75MJDg9vQrM/ZRb29+Qfyw==
513-
514-
"@typescript/typescript-win32-arm64@7.1.0-dev.20260919.1":
515-
version "7.1.0-dev.20260919.1"
516-
resolved "https://registry.yarnpkg.com/@typescript/typescript-win32-arm64/-/typescript-win32-arm64-7.1.0-dev.20260919.1.tgz#f36dba04ffa3eadc04f68d611b498274703deb16"
517-
integrity sha512-UcIw0d+yLZS7TF0i5OjU5XRtIcEkkxDtePxComdlrWG0xi/m0r67rd11rWpo+9VX8kRyWJUpbqmUUHj+oGfO8g==
518-
519-
"@typescript/typescript-win32-x64@7.1.0-dev.20260919.1":
520-
version "7.1.0-dev.20260919.1"
521-
resolved "https://registry.yarnpkg.com/@typescript/typescript-win32-x64/-/typescript-win32-x64-7.1.0-dev.20260919.1.tgz#0b36a27248dddb6c47620ab16cde85259aafa3cd"
522-
integrity sha512-FwxjA7IAoW+Sz8EGezmjiyJxbcH2iYTh47co6cA8HZYNYO8vdWcjweywAW0btvd+sJhH00O1d4e9UpBZsTHzxg==
489+
"@typescript/typescript-darwin-arm64@7.1.0-dev.20260922.1":
490+
version "7.1.0-dev.20260922.1"
491+
resolved "https://registry.yarnpkg.com/@typescript/typescript-darwin-arm64/-/typescript-darwin-arm64-7.1.0-dev.20260922.1.tgz#5e82f2c4ff8b42fbdbfaa9a0f98cadc6cc9691f9"
492+
integrity sha512-Yp+LWe9FJBnOmTo4ImaWwwRQqfyTMyq1jDu5EH4IWRAVxdm982LRB4j30bCBycre4ReFzA+Is5Uc+i6jvem0Dg==
493+
494+
"@typescript/typescript-darwin-x64@7.1.0-dev.20260922.1":
495+
version "7.1.0-dev.20260922.1"
496+
resolved "https://registry.yarnpkg.com/@typescript/typescript-darwin-x64/-/typescript-darwin-x64-7.1.0-dev.20260922.1.tgz#b591c515d90df35163a819b30793c0a6bcce91f3"
497+
integrity sha512-G8iU8StWDoUOu+n1INfCI46iS/0Tu/rUw0bWCJxCv5TjDzlzR9v2riA+BeDcKSwGgzYnFSCc9HRu4rnrCwFtag==
498+
499+
"@typescript/typescript-linux-arm64@7.1.0-dev.20260922.1":
500+
version "7.1.0-dev.20260922.1"
501+
resolved "https://registry.yarnpkg.com/@typescript/typescript-linux-arm64/-/typescript-linux-arm64-7.1.0-dev.20260922.1.tgz#6bbb349bb2d54b45890320e939da9464da66bfcb"
502+
integrity sha512-6+dj4AsWeserJ5/5f3DgI+ibzJBr3l7pXEGxMUuv+lwoQ6QDVZ1tOGaJdsZy4Hg5atMZi/m7iuDFJPvWbYYMxQ==
503+
504+
"@typescript/typescript-linux-arm@7.1.0-dev.20260922.1":
505+
version "7.1.0-dev.20260922.1"
506+
resolved "https://registry.yarnpkg.com/@typescript/typescript-linux-arm/-/typescript-linux-arm-7.1.0-dev.20260922.1.tgz#84a6eb7ed6d300f93a2f61a27aa71f44190309e6"
507+
integrity sha512-4w+Ztlff1U5INtBEeYnNBvBkDkAjH+lwQspxBEmVKxcvDDigYYIH6JpRx7zt3znxsR9Z3Fk5JQAgW5U8ve1tZg==
508+
509+
"@typescript/typescript-linux-x64@7.1.0-dev.20260922.1":
510+
version "7.1.0-dev.20260922.1"
511+
resolved "https://registry.yarnpkg.com/@typescript/typescript-linux-x64/-/typescript-linux-x64-7.1.0-dev.20260922.1.tgz#5e6b8e7550dc4d019cfd7ca4e09506c4efc7398f"
512+
integrity sha512-E4/JVTP1bJFk99cdsIG+AjLAuQEPpRDlwyhUExb6n6tqCPBeI4QlQa9bHZwv3xAMwRpYx5yHyYde2G5Isou7Dg==
513+
514+
"@typescript/typescript-win32-arm64@7.1.0-dev.20260922.1":
515+
version "7.1.0-dev.20260922.1"
516+
resolved "https://registry.yarnpkg.com/@typescript/typescript-win32-arm64/-/typescript-win32-arm64-7.1.0-dev.20260922.1.tgz#8c6d5cf7f74310cdd7f5ade77f3f2a703705890a"
517+
integrity sha512-0LE0ikOpuZN2RGqGfOJHjtHFGVsQ0QWUcLxqaA02kpHhs95wuPjbgSJTp1bTCw86CMsTR3RLj/N1NGtw0IC6tw==
518+
519+
"@typescript/typescript-win32-x64@7.1.0-dev.20260922.1":
520+
version "7.1.0-dev.20260922.1"
521+
resolved "https://registry.yarnpkg.com/@typescript/typescript-win32-x64/-/typescript-win32-x64-7.1.0-dev.20260922.1.tgz#e6944f369baa7c48ad7b7db749ec7fb2d0b569fe"
522+
integrity sha512-EysfoTSY19NBoG9RAdTz6/YT0HisIFzBak359KEvjeGMEggawBgWrjCfxjsWFuMd3fTt13USQ7W5aPH6+VrZpA==
523523

524524
"@webassemblyjs/ast@1.14.1", "@webassemblyjs/ast@^1.14.1":
525525
version "1.14.1"
@@ -4110,18 +4110,18 @@ typedarray@^0.0.6:
41104110
resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz"
41114111
integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==
41124112

4113-
typescript@7.1.0-dev.20260919.1:
4114-
version "7.1.0-dev.20260919.1"
4115-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-7.1.0-dev.20260919.1.tgz#1a0bbf9e1aa4b1813df78e0d9afc6bba703fe94c"
4116-
integrity sha512-eb+H1dNdW3lcSZdknA3dEap7cV2LQN33HYYs64TLvV6aneeYx+8mNEmCC3xCDuvVJxMJPNas8sbdt54VR/+KVQ==
4113+
typescript@next:
4114+
version "7.1.0-dev.20260922.1"
4115+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-7.1.0-dev.20260922.1.tgz#c11e8b39840daa86335b366c7150b0542367b8b1"
4116+
integrity sha512-m8MHrUEVO3XMp+5fsI15IiSCFVKLIVQxltwRYiI3VVpLIgjKZYy6Ec5JnzoQ6i9vC9B7FfCU3cmOj0uZP4HU/g==
41174117
optionalDependencies:
4118-
"@typescript/typescript-darwin-arm64" "7.1.0-dev.20260919.1"
4119-
"@typescript/typescript-darwin-x64" "7.1.0-dev.20260919.1"
4120-
"@typescript/typescript-linux-arm" "7.1.0-dev.20260919.1"
4121-
"@typescript/typescript-linux-arm64" "7.1.0-dev.20260919.1"
4122-
"@typescript/typescript-linux-x64" "7.1.0-dev.20260919.1"
4123-
"@typescript/typescript-win32-arm64" "7.1.0-dev.20260919.1"
4124-
"@typescript/typescript-win32-x64" "7.1.0-dev.20260919.1"
4118+
"@typescript/typescript-darwin-arm64" "7.1.0-dev.20260922.1"
4119+
"@typescript/typescript-darwin-x64" "7.1.0-dev.20260922.1"
4120+
"@typescript/typescript-linux-arm" "7.1.0-dev.20260922.1"
4121+
"@typescript/typescript-linux-arm64" "7.1.0-dev.20260922.1"
4122+
"@typescript/typescript-linux-x64" "7.1.0-dev.20260922.1"
4123+
"@typescript/typescript-win32-arm64" "7.1.0-dev.20260922.1"
4124+
"@typescript/typescript-win32-x64" "7.1.0-dev.20260922.1"
41254125

41264126
ua-parser-js@^0.7.30:
41274127
version "0.7.41"

0 commit comments

Comments
 (0)