Reputation: 97
Haii I am New to visual Studio , i have created a simple Type Script file Test.ts Here is the code
let hm:Map<number,String> = new Map<number,String>();
let uname=1;
let pass="String";
hm.set(uname,pass);
console.log(hm);
i am compiled the file using tsc Test.ts
but i am getting following error could some one help me how to resolve , i am not using angular just a type script file thats it
Test.ts:1:8 - error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2015' or later.
1 let hm:Map<number,String> = new Map<number,String>();
how to resolve this error , do i need to use tsconfig.json necessarily or i can change the Editor to use later version of es2015 directly
Upvotes: 3
Views: 6391
Reputation: 56
So I
tsc --init
;"lib": []
property;"es2015"
to the lib array: "lib": ["es2015"]
;tsc
in the command line;and that helped: I got the file.js script that could be executed by node file.js
!
Upvotes: 0
Reputation: 156
In the tsconfig.json, try adding the target library as below
{
"compilerOptions": {
"target": "es5"
}
}
Upvotes: 1