Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Cannot read property 'expression' of undefined #249

Closed
vjeux opened this issue May 4, 2017 · 7 comments
Closed

Cannot read property 'expression' of undefined #249

vjeux opened this issue May 4, 2017 · 7 comments
Assignees
Labels

Comments

@vjeux
Copy link

vjeux commented May 4, 2017

There are two tests in the typescript codebase that make typescript-eslint-parser throw:

../TypeScript/tests//cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause1.ts: TypeError: Cannot read property 'expression' of undefined
    at convert (/Users/despairblue/git/prettier/node_modules/typescript-eslint-parser/lib/ast-converter.js:1580:79)
../TypeScript/tests//cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause3.ts: TypeError: Cannot read property 'expression' of undefined
    at convert (/Users/despairblue/git/prettier/node_modules/typescript-eslint-parser/lib/ast-converter.js:1580:79)
    at convertChild (/Users/despairblue/git/prettier/node_modules/typescript-eslint-parser/lib/ast-converter.js:501:20)
    at /Users/despairblue/git/prettier/node_modules/typescript-eslint-parser/lib/ast-converter.js:746:46
    at Array.forEach (native)
    at convert (/Users/despairblue/git/prettier/node_modules/typescript-eslint-parser/lib/ast-converter.js:745:33)
    at module.exports (/Users/despairblue/git/prettier/node_modules/typescript-eslint-parser/lib/ast-converter.js:2089:18)
    at Object.parse (/Users/despairblue/git/prettier/node_modules/typescript-eslint-parser/parser.js:239:12)
    at parseWithTypeScript (/Users/despairblue/git/prettier/src/parser.js:58:17)
    at parse (/Users/despairblue/git/prettier/index.js:32:12)
    at format (/Users/despairblue/git/prettier/index.js:80:15)
    at formatWithShebang (/Users/despairblue/git/prettier/index.js:91:12)
    at Object.format (/Users/despairblue/git/prettier/index.js:105:12)

Was found in prettier/prettier#1480

Those are the only two crashes from typescript-eslint-parser of the entire run: https://gist.githubusercontent.com/despairblue/79e090660fbb4093b35ab3b24c617dfb/raw/99e47ad1e34c32ddd91c15315f3c4fb92fa37d65/errors

@soda0289
Copy link
Member

soda0289 commented May 4, 2017

Thanks for the report.

Do you have some sample code that can reproduce the problem? I'm having a hard time understanding the output you posted

@vjeux
Copy link
Author

vjeux commented May 4, 2017

This is the stack trace from this project:

    at convert (typescript-eslint-parser/lib/ast-converter.js:1580:79)
    at convertChild (typescript-eslint-parser/lib/ast-converter.js:501:20)
    at typescript-eslint-parser/lib/ast-converter.js:746:46
    at Array.forEach (native)
    at convert (typescript-eslint-parser/lib/ast-converter.js:745:33)
    at module.exports (typescript-eslint-parser/lib/ast-converter.js:2089:18)
    at Object.parse (typescript-eslint-parser/parser.js:239:12)

@soda0289
Copy link
Member

soda0289 commented May 4, 2017

@vjeux Thanks.

I did not know extend could be empty, you would think the typescript parser would complain about this. Will fix this case later today.

@vjeux
Copy link
Author

vjeux commented May 4, 2017

This looks like it's in "ErrorRecovery" directory, so typescript is trying to be lenient around those things.

@vjeux
Copy link
Author

vjeux commented May 4, 2017

The good thing is that this is the only error triggered by this project when running against all the 11k files of the typescript test suite :)

@JamesHenry
Copy link
Member

That is fantastic news, thanks again for running those tests!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants