Closed
Description
TypeScript Version: 3.7.0-dev.20190903
Search Terms:
allowJs, TypeError, Cannot read property 'exports' of undefined
Code
https://github.com/thomaseizinger/typescript-bcoin-crash
Expected behavior:
Being able to import and use the library bcoin
with allowJs
enabled.
Actual behavior:
Trying to use bcoin
crashes the compiler with:
~/src/github.com/thomaseizinger/typescript-bcoin-crash(master) » yarn tsc
yarn run v1.16.0
$ /home/thomas/src/github.com/thomaseizinger/typescript-bcoin-crash/node_modules/.bin/tsc
/home/thomas/src/github.com/thomaseizinger/typescript-bcoin-crash/node_modules/typescript/lib/tsc.js:23296
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
^
TypeError: Cannot read property 'exports' of undefined
at declareModuleMember (/home/thomas/src/github.com/thomaseizinger/typescript-bcoin-crash/node_modules/typescript/lib/tsc.js:23296:63)
at delayedBindJSDocTypedefTag (/home/thomas/src/github.com/thomaseizinger/typescript-bcoin-crash/node_modules/typescript/lib/tsc.js:24397:25)
at bindSourceFile (/home/thomas/src/github.com/thomaseizinger/typescript-bcoin-crash/node_modules/typescript/lib/tsc.js:23085:17)
at Object.bindSourceFile (/home/thomas/src/github.com/thomaseizinger/typescript-bcoin-crash/node_modules/typescript/lib/tsc.js:23034:9)
at initializeTypeChecker (/home/thomas/src/github.com/thomaseizinger/typescript-bcoin-crash/node_modules/typescript/lib/tsc.js:51464:20)
at Object.createTypeChecker (/home/thomas/src/github.com/thomaseizinger/typescript-bcoin-crash/node_modules/typescript/lib/tsc.js:26729:9)
at getDiagnosticsProducingTypeChecker (/home/thomas/src/github.com/thomaseizinger/typescript-bcoin-crash/node_modules/typescript/lib/tsc.js:75651:93)
at Object.getGlobalDiagnostics (/home/thomas/src/github.com/thomaseizinger/typescript-bcoin-crash/node_modules/typescript/lib/tsc.js:76008:72)
at emitFilesAndReportErrors (/home/thomas/src/github.com/thomaseizinger/typescript-bcoin-crash/node_modules/typescript/lib/tsc.js:79168:46)
at Object.emitFilesAndReportErrorsAndGetExitStatus (/home/thomas/src/github.com/thomaseizinger/typescript-bcoin-crash/node_modules/typescript/lib/tsc.js:79195:18)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
------------------------------------------------------------
I was able to locate at least one of the files that cause the problem, it is: node_modules/bcoin/lib/blockchain/common.js
. Here is a link to a repository that reproduces the issue:
https://github.com/thomaseizinger/typescript-bcoin-crash
Playground Link:
Not applicable.
Related Issues: