From be2c899ca796bd6dc54e074fdb2c5a32df51213d Mon Sep 17 00:00:00 2001 From: Blake Embrey Date: Sat, 21 Mar 2020 19:03:36 -0700 Subject: [PATCH] Fix `--files` support --- src/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 59bd8ec97..99bb82ded 100644 --- a/src/index.ts +++ b/src/index.ts @@ -457,7 +457,7 @@ export function create (rawOptions: CreateOptions = {}): Register { // Use language services by default (TODO: invert next major version). if (!options.compilerHost) { let projectVersion = 1 - const fileVersions = new Map() + const fileVersions = new Map(rootFileNames.map(fileName => [fileName, 0])) const getCustomTransformers = () => { if (typeof transformers === 'function') { @@ -471,10 +471,10 @@ export function create (rawOptions: CreateOptions = {}): Register { // Create the compiler host for type checking. const serviceHost: _ts.LanguageServiceHost = { getProjectVersion: () => String(projectVersion), - getScriptFileNames: () => Array.from(fileContents.keys()), + getScriptFileNames: () => Array.from(fileVersions.keys()), getScriptVersion: (fileName: string) => { const version = fileVersions.get(fileName) - return version === undefined ? '' : version.toString() + return version ? version.toString() : '' }, getScriptSnapshot (fileName: string) { let contents = fileContents.get(fileName)