TSAsExpression could not be resolved on function literal type
Opened this issue · 1 comments
Deleted user commented
What code were you trying to parse?
I use @typescript-eslint/parser
parser for TypeScript files.
When I try to lint the code below, It cannot parse functional type.
<MyButton
// ... some codes
onClick={handleSubmit as ((e: any) => void)}
/>
What did you expect to happen?
Parse ((e: any)=> void)
as usual type.
What actually happened?
Error: The prop value with an expression type of TSAsExpression could not be resolved.
Please file issue to get this fixed immediately.
Occurred while linting /Users/MyProject/src/MyComponent.tsx:151
at Object.extract [as JSXExpressionContainer] (/Users/MyProject/node_modules/jsx-ast-utils/lib/values/expressions/index.js:179:11)
at getValue (/Users/MyProject/node_modules/jsx-ast-utils/lib/values/index.js:48:27)
at extractValue (/Users/MyProject/node_modules/jsx-ast-utils/lib/getPropValue.js:24:12)
at getPropValue (/Users/MyProject/node_modules/jsx-ast-utils/lib/getPropValue.js:41:10)
at /Users/MyProject/node_modules/eslint-plugin-jsx-a11y/lib/rules/no-noninteractive-element-interactions.js:90:95
at Array.some (<anonymous>)
at JSXOpeningElement (/Users/MyProject/node_modules/eslint-plugin-jsx-a11y/lib/rules/no-noninteractive-element-interactions.js:89:52)
at listeners.(anonymous function).forEach.listener (/Users/MyProject/node_modules/eslint/lib/util/safe-emitter.js:45:58)
at Array.forEach (<anonymous>)
at Object.emit (/Users/MyProject/node_modules/eslint/lib/util/safe-emitter.js:45:38)
Versions
package | version |
---|---|
@typescript-eslint/parser |
2.1.0 |
TypeScript |
3.4.5 |
ESLint |
5.12.0 |
node |
8.14.1 |
npm |
6.11.3 |
( Came from typescript-eslint/typescript-eslint#966 )
So I've tried to figure it out,
https://github.com/evcohen/jsx-ast-utils/blob/master/src/values/expressions/index.js#L63-L91
but I don't know why TSAsExpression escape from while
loop.
Deleted user commented
After I update eslint-plugin-jsx-a11y to v6.2.3, This error does not occur.
Maybe this related with #82 (comment) .