Skip to content

TypeError: Cannot read property 'type' of undefined in TypeScript 1.8 beta #7031

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
bdespres opened this issue Feb 11, 2016 · 1 comment
Closed
Assignees
Labels
Duplicate An existing issue was already created

Comments

@bdespres
Copy link

Using TypeScript 1.8 beta with the "--allowJs" flag to compile a .js file with JSDoc comments causes a compiler crash for any file JS containing a JSDoc @return comment. For example:

/**
 * @return the number 5
 */
 function five() {
    return 5;
 }

% tsc --allowJs --outDir /tmp test.js

/home/bill/Applications/node-v4.2.4-linux-x64/lib/node_modules/typescript/lib/tsc.js:32796
                throw e;
                ^

TypeError: Cannot read property 'type' of undefined
    at getReturnTypeFromJSDocComment (/home/bill/Applications/node-v4.2.4-linux-x64/lib/node_modules/typescript/lib/tsc.js:19407:68)
    at getSignatureFromDeclaration (/home/bill/Applications/node-v4.2.4-linux-x64/lib/node_modules/typescript/lib/tsc.js:14802:36)
    at checkSpecializedSignatureDeclaration (/home/bill/Applications/node-v4.2.4-linux-x64/lib/node_modules/typescript/lib/tsc.js:20664:29)
    at checkSignatureDeclaration (/home/bill/Applications/node-v4.2.4-linux-x64/lib/node_modules/typescript/lib/tsc.js:20420:13)
    at checkFunctionOrMethodDeclaration (/home/bill/Applications/node-v4.2.4-linux-x64/lib/node_modules/typescript/lib/tsc.js:21170:13)
    at checkFunctionDeclaration (/home/bill/Applications/node-v4.2.4-linux-x64/lib/node_modules/typescript/lib/tsc.js:21161:17)
    at checkSourceElement (/home/bill/Applications/node-v4.2.4-linux-x64/lib/node_modules/typescript/lib/tsc.js:22800:28)
    at Object.forEach (/home/bill/Applications/node-v4.2.4-linux-x64/lib/node_modules/typescript/lib/tsc.js:98:30)
    at checkSourceFileWorker (/home/bill/Applications/node-v4.2.4-linux-x64/lib/node_modules/typescript/lib/tsc.js:22908:20)
    at checkSourceFile (/home/bill/Applications/node-v4.2.4-linux-x64/lib/node_modules/typescript/lib/tsc.js:22894:13)
``
@RyanCavanaugh RyanCavanaugh self-assigned this Feb 11, 2016
@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Feb 11, 2016
@RyanCavanaugh
Copy link
Member

Duplicate of #6662

@RyanCavanaugh RyanCavanaugh added Duplicate An existing issue was already created and removed Bug A bug in TypeScript labels Feb 11, 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
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants