Skip to content
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

TSAsExpression could not be resolved on function literal type #92

Closed
ghost opened this issue Sep 13, 2019 · 1 comment
Closed

TSAsExpression could not be resolved on function literal type #92

ghost opened this issue Sep 13, 2019 · 1 comment

Comments

@ghost
Copy link

ghost commented Sep 13, 2019

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.

@ghost ghost changed the title TSAsExpression could not be resolved on function type TSAsExpression could not be resolved on function literal type Sep 13, 2019
@ghost
Copy link
Author

ghost commented Sep 13, 2019

After I update eslint-plugin-jsx-a11y to v6.2.3, This error does not occur.
Maybe this related with #82 (comment) .

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

No branches or pull requests

1 participant