Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
@wkrueger

Description

@wkrueger
Issue body actions

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.

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.