Skip to content
Permalink
Browse files

fix(compiler): return `undefined` for `getScriptVersion` when a file …

…doesn't exist in memory cache (#1641)
  • Loading branch information
ahnpnl committed May 14, 2020
1 parent 6b22e08 commit 6851b8eae8caf15247d8b327cb73c9eda6ef11a3
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/compiler/language-service.ts
@@ -82,7 +82,7 @@ export const initializeLanguageServiceInstance = (
getScriptFileNames: () => [...memoryCache.files.keys()],
getScriptVersion: (fileName: string) => {
const normalizedFileName = normalize(fileName)
const version = memoryCache.files.get(normalizedFileName)!.version
const version = memoryCache.files.get(normalizedFileName)?.version

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

0 comments on commit 6851b8e

Please sign in to comment.
You can’t perform that action at this time.