Skip to content

Commit

Permalink
Fix --files support
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey committed Mar 22, 2020
1 parent 3766cc9 commit be2c899
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, number>()
const fileVersions = new Map(rootFileNames.map(fileName => [fileName, 0]))

const getCustomTransformers = () => {
if (typeof transformers === 'function') {
Expand All @@ -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)
Expand Down

0 comments on commit be2c899

Please sign in to comment.