I am trying to use GSAP in a project with React 15.4.2 and TypeScript 3.7.2
I did the following: npm i gsap --save
Then I did this in my .tsx file:
import * as T from 'gsap
I then built the project, but am getting these errors:
Error - typescript - node_modules\gsap\types\gsap-utils.d.ts(97,75): error TS1144: '{' or ';' expected.
So I was reading through these forums, and I did the following:
npm install @types/greensock
But that didn't work.
I tried the following too:
import gsap from "gsap";
That doesn't work as well.
What am I doing wrong here? I can't find a step by step guidance to how to set things up with npm based projects, sometimes forums say import * as something from 'gsap' sometimes it's import gsap from 'gsap'. Can anyone guide me here?
P.S:
Here's my tsconfig.json:
{
"compilerOptions": {
"target": "es5",
"forceConsistentCasingInFileNames": true,
"module": "commonjs",
"jsx": "react",
"declaration": true,
"sourceMap": true,
"experimentalDecorators": true,
"skipLibCheck": true,
"typeRoots": [
"./node_modules/@types"
],
"types": [
"es6-promise",
"webpack-env"
],
"lib": [
"es5",
"dom",
"es2015.collection"
]
}
}
Thanks.