-
-
Notifications
You must be signed in to change notification settings - Fork 664
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
"Parsing error: Unexpected token. Did you mean {'>'}
or >
?" when using arrow functions
#1343
Comments
I think you need to rewrite it as follows: - const canvas = <HTMLCanvasElement> document.getElementById("renderCanvas"); // Get the canvas element
+ const canvas = document.getElementById("renderCanvas") as HTMLCanvasElement; // Get the canvas element Or, change the setting of |
Thanks a lot, both of your recommandations did indeed work. parserOptions: {
parser: "@typescript-eslint/parser",
ecmaFeatures : {
jsx : false
}
}, Edit: also adding my tsconfig.json to the parser options did help. Maybe that was lost at some point |
For anyone facing this issue: I uninstalled |
Your |
Thank you, I got it |
Have you updated |
I was a few minor versions behind on |
{["aa","bb","cc","dd"]}.map((item) => { Parsing error: Unexpected token |
it fixed in my case, below is the diff - const someFunc = <D>(data: D): void => { console.log() };
+ const someFunc = <D, >(data: D): void => { console.log() }; it works for
|
Please don't comment on this issue; it was closed 3 years ago. I'll lock the conversation now, please open new issues instead, and please follow the respective issue templates. For anyone using TypeScript: Please see https://eslint.vuejs.org/user-guide/#how-to-use-a-custom-parser. |
Hi everyone,
I am struggling with this problem for days now, and simply can't find the right eslint configuration to fix this.
This is more or less what my code looks like:
I always get this weird parsing error where i declare the arrow function inside as a parameter for
this.engine.runRenderLoop
(a BabylonJS method if someone wonders).This did not happen when i was not using the typescript parser.
Here is what my .eslint.js file looks like:
What i've already found out: When I uncomment the line
parser: "@typescript-eslint/parser",
the error disappears, but a lot of other error pop up, because apparently the typescript-eslint parser doesn't know anything about how .vue files are strutured.Something like "Parsing error: Identifier expected." on a normal
@wheel
event listener in the template part.What confuses me really is that other arrow functions do work, but just this one doesn't... I am really out of ideas.
Any help appreciated!
The text was updated successfully, but these errors were encountered: