Typescript project references cache not invalidated with @types/node version change in package.json

25 views Asked by At

I'm tackling a monorepo utilizing TypeScript (v4.9.5) with project references for type checking across the repository. Recently, we transitioned to a new Node.js version (18.19.1), necessitating an update to @types/node in the package.json.

Upon running tsc -b tsconfig.json -v, TypeScript failed to type check the repository, citing the previous emitted cache as up to date. Consequently, it failed to detect errors in the code pertaining to changes in types introduced by the newer Node.js version.

When invoking tsc with the -b flag, my expectation was that TypeScript would invalidate the old cache due to the version change in @types/node. However, it didn't, indicating that the cache was already updated with the changes.

  1. Is this behavior expected?
  2. If not, what steps can I take to automatically invalidate the cache when type versions change?
0

There are 0 answers