Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'exports' of undefined #36983

Closed
mjbvz opened this issue Feb 24, 2020 · 2 comments · Fixed by #36996
Closed

Cannot read property 'exports' of undefined #36983

mjbvz opened this issue Feb 24, 2020 · 2 comments · Fixed by #36996
Assignees
Labels
Bug A bug in TypeScript VS Code Priority Critical issues that VS Code needs fixed in the current TypeScript milestone

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Feb 24, 2020

TypeScript Version: 3.9.0-dev.20200223

Search Terms:

  • updateOpen
  • applyChangesInOpenFiles

Repo

  1. git clone https://github.com/thanpolas/middlewarify.git
  2. Open index.js in VSCode

Bug

Cannot read property 'exports' of undefined
TypeError: Cannot read property 'exports' of undefined
    at declareModuleMember (tsserver.js:30420:63)
    at delayedBindJSDocTypedefTag (tsserver.js:31843:29)
    at bindSourceFile (tsserver.js:30121:17)
    at Object.bindSourceFile (tsserver.js:30054:9)
    at initializeTypeChecker (tsserver.js:66453:20)
    at Object.createTypeChecker (tsserver.js:34861:9)
    at Object.getTypeChecker (tsserver.js:98607:79)
    at synchronizeHostData (tsserver.js:135685:21)
    at Proxy.getProgram (tsserver.js:135767:13)
    at InferredProject.Project.updateGraphWorker (tsserver.js:140244:53)
    at InferredProject.Project.updateGraph (tsserver.js:140187:42)
    at ProjectService.assignOrphanScriptInfoToInferredProject (tsserver.js:142163:25)
    at ProjectService.assignProjectToOpenedScriptInfo (tsserver.js:143593:26)
    at tsserver.js:143858:107
    at Object.mapDefined (tsserver.js:562:30)
    at ProjectService.applyChangesInOpenFiles (tsserver.js:143858:48)
    at Session.handlers.ts.createMapFromTemplate._a.<computed> (tsserver.js:144722:46)
    at tsserver.js:146465:88
    at IOSession.Session.executeWithRequestId (tsserver.js:146456:28)
    at IOSession.Session.executeCommand (tsserver.js:146465:33)
    at IOSession.Session.onMessage (tsserver.js:146489:35)
    at Interface.<anonymous> (tsserver.js:147804:27)
    at Interface.emit (events.js:203:13)
    at Interface._onLine (readline.js:316:10)
    at Interface._normalWrite (readline.js:461:12)
    at Socket.ondata (readline.js:172:10)
    at Socket.emit (events.js:203:13)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:276:11)
    at Socket.Readable.push (_stream_readable.js:210:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:166:17) 
@mjbvz mjbvz added the VS Code Priority Critical issues that VS Code needs fixed in the current TypeScript milestone label Feb 24, 2020
@mjbvz
Copy link
Contributor Author

mjbvz commented Feb 24, 2020

@RyanCavanaugh Marking as priority since this causes VS Code to restart the TS Server. We'd like a fix for a TS 3.8.x recovery

@RyanCavanaugh
Copy link
Member

Compile with --allowJs

var middlewarify = module.exports = {};

/** @enum */
middlewarify.Type = {
  BEFORE: 'before'
};
                        return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); // No local symbol for an unnamed default!
                                                              ^

TypeError: Cannot read property 'exports' of undefined
    at declareModuleMember (D:\github\TypeScript\built\local\tsc.js:30390:63)
    at delayedBindJSDocTypedefTag (D:\github\TypeScript\built\local\tsc.js:31813:29)
    at bindSourceFile (D:\github\TypeScript\built\local\tsc.js:30091:17)
    at Object.bindSourceFile (D:\github\TypeScript\built\local\tsc.js:30024:9)
    at initializeTypeChecker (D:\github\TypeScript\built\local\tsc.js:66416:20)
    at Object.createTypeChecker (D:\github\TypeScript\built\local\tsc.js:34831:9)
    at getDiagnosticsProducingTypeChecker (D:\github\TypeScript\built\local\tsc.js:98564:93)
    at Object.getGlobalDiagnostics (D:\github\TypeScript\built\local\tsc.js:98991:72)
    at emitFilesAndReportErrors (D:\github\TypeScript\built\local\tsc.js:102870:53)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript VS Code Priority Critical issues that VS Code needs fixed in the current TypeScript milestone
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@sandersn @RyanCavanaugh @mjbvz and others