Description
What code were you trying to parse?
I try to lint the following code:
async something(@Arg() { email }: SomeInput): Promise<boolean> {}
The linting crashes with the stack trace listed under "What actually happened?".
Changing the code to:
async something(@Arg() input: SomeInput): Promise<boolean> {}
makes the rule run fine.
I created a repo for easier reproduction: https://github.com/rfermann/args-decorator-parser-error.
What did you expect to happen?
I expect to not get a TypeError
during linting
What actually happened?
I got a TypeError
during linting:
eslint index.ts
TypeError: Cannot read property 'type' of undefined
at isForInRef (C:\Users\parser-issue\node_modules\eslint\lib\rules\no-unused-vars.js:434:24)
at variable.references.some.ref (C:\Users\parser-issue\node_modules\eslint\lib\rules\no-unused-vars.js:471:21)
at Array.some ()
at isUsedVariable (C:\Users\parser-issue\node_modules\eslint\lib\rules\no-unused-vars.js:470:40)
at collectUnusedVariables (C:\Users\parser-issue\node_modules\eslint\lib\rules\no-unused-vars.js:582:26)
at collectUnusedVariables (C:\Users\parser-issue\node_modules\eslint\lib\rules\no-unused-vars.js:589:17)
at Program:exit (C:\Users\parser-issue\node_modules\eslint\lib\rules\no-unused-vars.js:634:36)
at listeners.(anonymous function).forEach.listener (C:\Users\parser-issue\node_modules\eslint\lib\util\safe-emitter.js:45:58)
at Array.forEach ()
at Object.emit (C:\Users\parser-issue\node_modules\eslint\lib\util\safe-emitter.js:45:38)
Versions
package | version |
---|---|
@typescript-eslint/parser |
1.3.0 |
TypeScript |
3.3.1 |
ESLint |
5.14.1 |
node |
10.11.0 |
npm |
6.4.1 |