Skip to content

projectVersion not bumped when rootFileNames changes #996

@cspotcode

Description

@cspotcode

Expected Behavior

getProjectVersion() is incremented when a new file is appended to getScriptFileNames() array.

Actual Behavior

getProjectVersion() is not incremented when a file is added to getScriptFileNames() during typechecking, before it has been require()d.

@blakeembrey it looks like this was changed here:
#985
That pull request means that all files added to the in-memory cache are also added to getScriptFileNames() so they need to trigger a bump of getProjectVersion() Otherwise it breaks the TS compiler's expectations, which might cause bugs down the road.

Steps to reproduce the problem

Omitted a rigorous reproduction until I double-check with you that this change was, indeed, accidental.

If you have a index.ts that imports a foo.ts, and you do ts-node ./index.ts:
typechecking will see the import statement, and updateMemoryCache will be called to pull foo.ts into the cache, adding it to the fileVersions Map.

Specifications

  • ts-node version: 8.8.1
  • TypeScript version: 3.8.3
  • tsconfig.json, if you're using one: no tsconfig
  • node version: 13.8.0
  • Operating system and version: tested on Windows & Ubuntu via WSL2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions