Skip to content

Instantly share code, notes, and snippets.

@junosuarez
Last active February 1, 2016 00:21
Show Gist options
  • Save junosuarez/7cd1433497897e64af9f to your computer and use it in GitHub Desktop.
Save junosuarez/7cd1433497897e64af9f to your computer and use it in GitHub Desktop.
Typescript error with --allowJavaScript - clone with git clone git@github.com:7cd1433497897e64af9f.git
function hi () {
return 'hi'
}
module.exports = hi
// compiles fine with:
// module.exports = function hi () {
// return 'hi'
// }
> tsc --version
Version 1.9.0-dev.20160131
> tsc --allowJs --outDir foo index.js
/usr/local/lib/node_modules/typescript/lib/tsc.js:33194
throw e;
^
TypeError: Cannot read property 'kind' of undefined
at getTargetOfAliasDeclaration (/usr/local/lib/node_modules/typescript/lib/tsc.js:12347:25)
at resolveAlias (/usr/local/lib/node_modules/typescript/lib/tsc.js:12371:30)
at resolveSymbol (/usr/local/lib/node_modules/typescript/lib/tsc.js:12363:101)
at resolveExternalModuleSymbol (/usr/local/lib/node_modules/typescript/lib/tsc.js:12499:52)
at resolveExternalModuleTypeByLiteral (/usr/local/lib/node_modules/typescript/lib/tsc.js:14915:44)
at checkCallExpression (/usr/local/lib/node_modules/typescript/lib/tsc.js:19439:24)
at checkExpressionWorker (/usr/local/lib/node_modules/typescript/lib/tsc.js:20314:28)
at checkExpression (/usr/local/lib/node_modules/typescript/lib/tsc.js:20264:42)
at checkExpressionCached (/usr/local/lib/node_modules/typescript/lib/tsc.js:20225:38)
at getTypeForVariableLikeDeclaration (/usr/local/lib/node_modules/typescript/lib/tsc.js:13672:24)
var a = require('./b')
console.log(a(), 'world')
module.exports = a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment