Closed
Description
When using the allowJs option and requiring a js file, if in this js file there is a
JSDoc type annotation with a string (e.g. @param input {'opt1'|'opt2'}
, the compiler fails with
Unknown entity name kind
.
Error: Debug Failure. False expression: Unknown entity name kind.
at Object.assert (/usr/local/lib/node_modules/typescript/lib/tsc.js:785:23)
at Object.fail (/usr/local/lib/node_modules/typescript/lib/tsc.js:790:19)
at resolveEntityName (/usr/local/lib/node_modules/typescript/lib/tsc.js:12515:26)
at resolveTypeReferenceName (/usr/local/lib/node_modules/typescript/lib/tsc.js:15214:20)
at getTypeFromTypeReference (/usr/local/lib/node_modules/typescript/lib/tsc.js:15238:30)
at getTypeFromTypeNode (/usr/local/lib/node_modules/typescript/lib/tsc.js:15543:28)
at Object.map (/usr/local/lib/node_modules/typescript/lib/tsc.js:163:29)
at getTypeFromUnionTypeNode (/usr/local/lib/node_modules/typescript/lib/tsc.js:15433:54)
at getTypeFromTypeNode (/usr/local/lib/node_modules/typescript/lib/tsc.js:15557:28)
at getTypeForVariableLikeDeclarationFromJSDocComment (/usr/local/lib/node_modules/typescript/lib/tsc.js:13689:24)
TypeScript Version: 1.8.0
Code
Checkout this repo: https://github.com/wkrueger/tsissue
or:
main.ts
import addPoint = require('./jsinclude')
jsinclude.js
/**
* @param inp {'type1'}
*/
module.exports.someFunction = (inp) => {
return inp + '.'
}
Expected
I'm not sure if strings in JSDocs are really valid. If they are, they should be recognized.
On the other hand, I guess that even if a given JSDoc comment is invalid, that should not block the compilation, but fallback to ignoring that JSDoc.