Skip to content

Commit

Permalink
When using cached sourceFile from the info, make sure the scriptKind …
Browse files Browse the repository at this point in the history
…is same

This is needed esp with externalFiles since they may not use actual scriptInfo and text at all
Fixes #57631
  • Loading branch information
sheetalkamat committed Mar 4, 2024
1 parent ac376fc commit a59f129
Show file tree
Hide file tree
Showing 2 changed files with 388 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/services/documentRegistry.ts
Expand Up @@ -13,6 +13,7 @@ import {
getKeyForCompilerOptions,
getOrUpdate,
getSetExternalModuleIndicator,
getSnapshotText,
identity,
IScriptSnapshot,
isDeclarationFileName,
Expand Down Expand Up @@ -300,7 +301,7 @@ export function createDocumentRegistryInternal(useCaseSensitiveFileNames?: boole
let entry = bucketEntry && getDocumentRegistryEntry(bucketEntry, scriptKind);
if (!entry && externalCache) {
const sourceFile = externalCache.getDocument(keyWithMode, path);
if (sourceFile) {
if (sourceFile && sourceFile.scriptKind === scriptKind && sourceFile.text === getSnapshotText(scriptSnapshot)) {
Debug.assert(acquiring);
entry = {
sourceFile,
Expand Down

0 comments on commit a59f129

Please sign in to comment.