Skip to content

VSCode "Import module" code action is no longer working after TypeScript 3 upgrade, tsserver throws error #26333

Closed

Description

@praxxis

TypeScript Version: 3.0.1, 3.1.0-dev.20180809

Search Terms: import code action

Expected behavior: VSCode "Import module" code action is no longer working after TypeScript 3 upgrade. Works fine in 2.9.x without needing to restart VSCode, and the error is in tsserver (per below).

Actual behavior:

On attempting to invoke a code action on an unknown symbol, which would normally show the "Import module" code action in TS2.9, the following error is logged:

Err 2421  [12:56:36.963] Exception on executing command {"seq":34,"type":"request","command":"getCodeFixes","arguments":{"file":"/Users/lindsey/Projects/frontend/src/index.tsx","startLine":89,"startOffset":3,"endLine":89,"endOffset":20,"errorCodes":[2304]}}:

    Debug Failure.

    Error: Debug Failure.
    at Object.assertDefined (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:1435:24)
    at getDefaultExportInfo (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:105189:63)
    at /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:105166:32
    at /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:105287:21
    at forEachExternalModule (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:105300:21)
    at forEachExternalModuleToImportFrom (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:105285:13)
    at getExportInfos (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:105161:13)
    at getFixesInfoForNonUMDImport (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:105147:57)
    at getFixesInfo (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:105085:19)
    at Object.getCodeActions (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:104870:28)
    at /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:103896:121
    at Object.flatMap (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:498:25)
    at Object.getFixes (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:103896:23)
    at /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:111747:35
    at Object.flatMap (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:498:25)
    at getCodeFixesAtPosition (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:111745:23)
    at Object.getCodeFixesAtPosition (/Users/lindsey/.vscode-insiders/extensions/jpoissonnier.vscode-styled-components-0.0.21/node_modules/typescript-template-language-service-decorator/lib/template-language-service-decorator.js:164:20)
    at IOSession.Session.getCodeFixes (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:119339:64)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:118213:61)
    at /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:119496:88
    at IOSession.Session.executeWithRequestId (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:119487:28)
    at IOSession.Session.executeCommand (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:119496:33)
    at IOSession.Session.onMessage (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:119516:35)
    at Interface.<anonymous> (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:120770:27)
    at emitOne (events.js:116:13)
    at Interface.emit (events.js:211:7)
    at Interface._onLine (readline.js:282:10)
    at Interface._normalWrite (readline.js:424:12)
    at Socket.ondata (readline.js:141:10)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at Pipe.onread (net.js:594:20)

tsconfig.json:

{
  "compilerOptions": {
    "outDir": "./dist/",
    "sourceMap": true,
    "noImplicitAny": true,
    "module": "esnext",
    "moduleResolution": "node",
    "target": "es5",
    "jsx": "react",
    "typeRoots": ["./typings"],
    "noUnusedParameters": true,
    "noUnusedLocals": true,
    "suppressImplicitAnyIndexErrors": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "lib": [
      "es6",
      "dom"
    ],
    "noImplicitThis": true,
    "allowJs": true,
    "plugins": [
      {
        "name": "typescript-styled-plugin"
      }
    ]
  },
  "include": [
    "./src/**/*",
    "node_modules/@types"
  ]
}

I'm not even sure where to start with trying to get more info on this, but I'm happy to provide any other configs if needed. As above this error doesn't happen at all in TS2.9, with no other changes to configs etc.

Activity

  1. praxxis commented on Aug 9, 2018

    @praxxis
    Author

    thanks for the quick response! Happy to run a debug build, my email is [redacted]

  2. ghost removed
    Needs More InfoThe issue still hasn't been fully clarified
    on Aug 10, 2018
  3. ghost added
    FixedA PR has been merged for this issue
    on Aug 10, 2018
  4. ghost closed this as completedin #26364on Aug 10, 2018
  5. markthiessen commented on Sep 2, 2018

    @markthiessen

    What does it mean that "a default export... is confusing tsserver" ?
    That's not enough info to try to find the export that's surfacing this issue..

    Can you provide any more details on the combination of things that result in this? .. I'm still on TS 2.9.1 because every published build since has had issues that broke my tooling... and this still doesn't seem to be resolved in the latest package.

  6. markthiessen commented on Sep 7, 2018

    @markthiessen

    Thanks.. but I'd rather not use a nightly build in my project with so many issues recently with published releases. I'll try 3.1 when it's released..

  7. 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

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions