Skip to content

Assertion violation: undefined relativeSpecifiers on Object.getModuleSpecifiers #42785

Closed

Description

From David Lannoye (@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)

Activity

  1. added
    BugA bug in TypeScript
    CrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad output
    on Feb 13, 2021
  2. btakita commented on Feb 23, 2021

    @btakita

    I'm getting a similar error:

    /patheu/typescript/lib/tsc.js:91587
                        ts.Debug.checkDefined(relativeSpecifiers);
                                 ^
    Error: Debug Failure.
        at Object.getModuleSpecifiers (/path/node_modules/typescript/lib/tsc.js:91587:30)
        at getSpecifierForModuleSymbol (/path/node_modules/typescript/lib/tsc.js:39998:62)
        at /path/node_modules/typescript/lib/tsc.js:39874:39
        at Array.map (<anonymous>)
        at getSymbolChain (/path/node_modules/typescript/lib/tsc.js:39872:58)
        at lookupSymbolChainWorker (/path/node_modules/typescript/lib/tsc.js:39858:51)
        at lookupSymbolChain (/path/node_modules/typescript/lib/tsc.js:39852:24)
        at symbolToTypeNode (/path/node_modules/typescript/lib/tsc.js:40005:29)
        at typeReferenceToTypeNode (/path/node_modules/typescript/lib/tsc.js:39463:40)
        at typeToTypeNodeHelper (/path/node_modules/typescript/lib/tsc.js:39155:95)
    
  3. btakita commented on Feb 24, 2021

    @btakita

    This seems to be related to type inference; as the solution to this crash is to explicitly declare the type of a const though I'm not able to reproduce the exact cause.

  4. 07akioni commented on Feb 24, 2021

    @07akioni

    This seems to be related to type inference; as the solution to this crash is to explicitly declare the type of a const though I'm not able to reproduce the exact cause.

    I'm facing the same problem (only in ts 4.2):

    ...
    // got error
    export const SsrContext = defineComponent({
    ...
    
    // pass
    export const SsrContext: ReturnType<typeof defineComponent> = defineComponent({
    ...
    
  5. flybayer commented on Feb 27, 2021

    @flybayer

    I'm having the same error, and I have a small reproduction repo: https://github.com/flybayer/tsc-broken (boilerplate for a new Blitz app)

    1. git clone git@github.com:flybayer/tsc-broken.git
    2. cd tsc-broken
    3. yarn
    4. yarn tsc

    Related: #42773

  6. dlannoye commented on Feb 27, 2021

    @dlannoye
    Member

    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.

  7. dylanvorster commented on Feb 28, 2021

    @dylanvorster

    have had to rollback to "typescript": "^4.1.5",. David Lannoye (@dlannoye) any chance you can open a PR?

  8. andrewbranch commented on Mar 1, 2021

    @andrewbranch
    Member

    Brandon Bayer (@flybayer) I can’t reproduce with your repo. I get a few checker errors but no crash:

    ❯ yarn tsc
    yarn run v1.22.4
    $ /System/Volumes/Data/Developer/microsoft/eg/tsc-broken/node_modules/.bin/tsc
    app/auth/mutations/forgotPassword.test.ts:12:3 - error TS2698: Spread types may only be created from object types.
    
    12   ...jest.requireActual("blitz")!,
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    db/index.ts:2:10 - error TS2305: Module '"@prisma/client"' has no exported member 'PrismaClient'.
    
    2 import { PrismaClient } from "@prisma/client"
               ~~~~~~~~~~~~
    
    types.ts:3:10 - error TS2614: Module '"db"' has no exported member 'User'. Did you mean to use 'import User from "db"' instead?
    
    3 import { User } from "db"
               ~~~~
    
    
    Found 3 errors.
    
    error Command failed with exit code 2.
    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
    

    David Lannoye (@dlannoye) (or actually anyone else who has seen this error), are you using pnpm or some other system that puts modules in a hidden folder (starting with .) inside node_modules? The line you reverted to fix your problem is supposed to filter out invalid module specifiers, and the crash means you were left with no valid module specifiers after the filtering. But if you’re not using pnpm, I’m very confused as to what was getting filtered out in the first place. If anyone can provide a small reproduction of this bug, that would be very helpful.

  9. flybayer commented on Mar 1, 2021

    @flybayer

    Andrew Branch (@andrewbranch) run yarn blitz prisma generate to fix those type errors, and then tsc should crash. That prisma command is supposed to run automatically. It generates code and typedefs at node_modules/.prisma.

  10. andrewbranch commented on Mar 1, 2021

    @andrewbranch
    Member

    Ah, yep, the .prisma is the culprit there. Are you supposed to be able to import from ".prisma"? We assume that anything in a dotted folder in node_modules is a temporary path and should be ignored.

  11. flybayer commented on Mar 1, 2021

    @flybayer

    Andrew Branch (@andrewbranch) no you import from @prisma/client, which internally imports from .prisma

  12. dlannoye commented on Mar 1, 2021

    @dlannoye
    Member

    Yes, I am using PNPM in my repository. The issue no longer reproduces if I clean and using npm instead for this project.

  13. MaikuMori commented on Mar 1, 2021

    @MaikuMori

    I have the same problem using yarn, also with prisma installed. I haven't tried to switch to npm.

  14. dlannoye commented on Mar 2, 2021

    @dlannoye
    Member

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

  15. sbalay commented on Mar 3, 2021

    @sbalay

    Andrew Branch (@andrewbranch) do you know if this fix will be released soon?

  16. andrewbranch commented on Mar 3, 2021

    @andrewbranch
    Member

    Yes; it will (4.2.3)

  17. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFix AvailableA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions