Skip to content

allowJs + jsdoc @param + string = compiler Error "Unknown entity name kind" #9902

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

Closed
wkrueger opened this issue Jul 22, 2016 · 1 comment
Closed
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@wkrueger
Copy link

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.

@mhegazy mhegazy added the Bug A bug in TypeScript label Jul 22, 2016
@mhegazy mhegazy added this to the TypeScript 2.0.1 milestone Jul 22, 2016
@sandersn
Copy link
Member

String literal types look pretty easy to add, so I'll just do it.

@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Aug 17, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants