Skip to content

Commit 6851b8e

Browse files
authored
fix(compiler): return undefined for getScriptVersion when a file doesn't exist in memory cache (#1641)
1 parent 6b22e08 commit 6851b8e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/compiler/language-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export const initializeLanguageServiceInstance = (
8282
getScriptFileNames: () => [...memoryCache.files.keys()],
8383
getScriptVersion: (fileName: string) => {
8484
const normalizedFileName = normalize(fileName)
85-
const version = memoryCache.files.get(normalizedFileName)!.version
85+
const version = memoryCache.files.get(normalizedFileName)?.version
8686

8787
// We need to return `undefined` and not a string here because TypeScript will use
8888
// `getScriptVersion` and compare against their own version - which can be `undefined`.

0 commit comments

Comments
 (0)