TypeScript: Assertion violation: undefined `relativeSpecifiers` on `Object.getModuleSpecifiers`

From @dlannoye:

dependencies_path\typescript@4.2.1-rc\node_modules\typescript\lib\tsc.js:91576
                    ts.Debug.checkDefined(relativeSpecifiers);
                             ^
Error: Debug Failure.
    at Object.getModuleSpecifiers (dependencies_path\typescript@4.2.1-rc\node_modules\typescript\lib\tsc.js:91576:30)
    at getSpecifierForModuleSymbol (dependencies_path\typescript@4.2.1-rc\node_modules\typescript\lib\tsc.js:39998:62)
    at dependencies_path\typescript@4.2.1-rc\node_modules\typescript\lib\tsc.js:39874:39
    at Array.map (<anonymous>)
    at getSymbolChain (dependencies_path\typescript@4.2.1-rc\node_modules\typescript\lib\tsc.js:39872:58)
    at lookupSymbolChainWorker (dependencies_path\typescript@4.2.1-rc\node_modules\typescript\lib\tsc.js:39858:51)
    at lookupSymbolChain (dependencies_path\typescript@4.2.1-rc\node_modules\typescript\lib\tsc.js:39852:24)
    at symbolToTypeNode (dependencies_path\typescript@4.2.1-rc\node_modules\typescript\lib\tsc.js:40005:29)
    at typeToTypeNodeHelper (dependencies_path\typescript@4.2.1-rc\node_modules\typescript\lib\tsc.js:39150:28)
    at mapToTypeNodes (dependencies_path\typescript@4.2.1-rc\node_modules\typescript\lib\tsc.js:39671:40)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 7
  • Comments: 15 (6 by maintainers)

Most upvoted comments

Just tested my codebase with "typescript": "4.3.0-dev.20210302" and can confirm that the assertion no longer reproduces. Thanks for the fix!

For my projects that were reproducing this I tracked it back to a regression introduced by #42095 .

I was able to get my projects building without the crash by reverting a single line in the PR that was doing extra filtering on the return of forEachFileNameOfModule in src/compiler/moduleSpecifiers.ts.

I am not sure if this is a complete fix and how it might interact with the desired behavior introduced by #42095.