Skip to content
Advertisement

Eslint throwing “Parsing error: Unexpected token” while using TypeScript

I installed @types/greensock and started using gsap with TypeScript. Everything works fine, but the ScrollTo plugin is giving this eslint error (image attached). Someone knows something about it?

Here is the eslint error:

enter image description here

Here is my .eslintrc:

JavaScript

Here is my code:

JavaScript

Advertisement

Answer

I have been told in the GreenSock forum that I shouldn’t be using @types/greensock as gsap has built in support for TypeScript. So I deleted it, and I updated my .eslintrc by replacing babel-eslint by @typescript-eslint/parser like below and the problem is gone.

Needed installs:

JavaScript

.eslintrc:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement