Skip to content

Commit

Permalink
fix(compiler): return undefined for getScriptVersion when a file …
Browse files Browse the repository at this point in the history
…doesn't exist in memory cache (#1641)
  • Loading branch information
ahnpnl authored May 14, 2020
1 parent 6b22e08 commit 6851b8e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/language-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down

0 comments on commit 6851b8e

Please sign in to comment.