john
john

Reputation: 1389

How to fix Cannot find name 'Set'

I have simple ts file with a simple sum function that just simple add two numbers no Rocket Science here below

function sum(a,b){
    return a+b;
}

But when I run

tsc TypeScript.ts

I get this error below?

   ts 
    ../../../../node_modules/@types/react/index.d.ts:388:23 - error TS2583: Cannot find name 
    'Set'. Do you need to change your target library? Try changing the `lib` compiler option 
    to es2015 or later.
    
    388         interactions: Set<SchedulerInteraction>,
                              ~~~
    
    
    Found 1 error.
    

How can i fix this error?

Upvotes: 11

Views: 9217

Answers (2)

Anshudeep Sahu
Anshudeep Sahu

Reputation: 1

npm install @types/node --save-dev

Open the command prompt. then paste this code. After installation is complete again run the code.

Upvotes: 0

john
john

Reputation: 1389

I searched through StackOverflow and i found the answer. Just type this following command in the terminal

npm install @types/node --save-dev

Then the error will dissapear!

Upvotes: 36

Related Questions