mrmckeb/typescript-plugin-css-modules

Plugin crashes TypeScript ProjectService in TS 5.3.2+

me4502 opened this issue · 2 comments

me4502 commented

Describe the bug
Upon updating to TS 5.3.2 or 5.3.3, this plugin causes the project service within IDE (VSCode) to error, and also causes TypeScript-ESLint with the EXPERIMENTAL_useProjectService option to also fail due to the project service erroring on creation.

Within IDE this is demonstrated by no type errors being reported, however the first line is underlined with Parsing error: Debug Failure. Expected undefined === 0. as the error.

The same error is printed out for every file when ESLint is run with the project service enabled.

Here's a stacktrace of the issue, using TypeScript 5.3.3,

Error: Debug Failure. Expected undefined === 0. 
    at acquireOrUpdateDocument (/workspace/node_modules/typescript/lib/typescript.js:134451:13)
    at Object.acquireDocumentWithKey (/workspace/node_modules/typescript/lib/typescript.js:134401:14)
    at getOrCreateSourceFileByPath (/workspace/node_modules/typescript/lib/typescript.js:143138:33)
    at Object.getOrCreateSourceFile (/workspace/node_modules/typescript/lib/typescript.js:143117:16)
    at /workspace/node_modules/typescript/lib/typescript.js:143041:44
    at Object.getSourceFileWithCache [as getSourceFile] (/workspace/node_modules/typescript/lib/typescript.js:118827:26)
    at findSourceFileWorker (/workspace/node_modules/typescript/lib/typescript.js:121129:25)
    at findSourceFile (/workspace/node_modules/typescript/lib/typescript.js:121049:22)
    at /workspace/node_modules/typescript/lib/typescript.js:120998:24
    at getSourceFileFromReferenceWorker (/workspace/node_modules/typescript/lib/typescript.js:120967:28)

To Reproduce
Steps to reproduce the behavior:

  1. Install this plugin and TypeScript 5.3.3
  2. Open a TypeScript file in IDE
  3. See error

Alternatively,

  1. Install this plugin and TypeScript 5.3.3, and a TypeScript ESLint setup
  2. Enable EXPERIMENTAL_useProjectService in the parserOptions
  3. Run the linter
  4. See the error. The DEBUG='*' env var allows seeing more in-depth stacktraces when it fails to parse the files

Expected behavior
The plugin should not be causing the project service within TypeScript to fail.

Screenshots
image

Desktop (please complete the following information):

  • OS: macOS 14.4
  • Browser Edge
  • Version 121

Additional context
Add any other context about the problem here.

Hi there, I wasn't able to reproduce this in my test project. I updated that project to TS 5.3.3, and then restarted VS Code, and everything was still working as expected.

Are you able to provide a very small reproduction for this?