Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeScript error: TS2304:Cannot find name 'Date'

I am trying to create a date object of javascript to store current date and time

let now:Date = new Date(); 

But the below line show error in my intellij as the below error:

TS2304:Cannot find name 'Date'.

I am guessing as Date is javascript object and new Date() is not available in typescript or in my project, its failing.

I am writing angularjs 1.5.9 in typescript, I dont thing is anything related to angularjs.

How to fix this?

like image 940
Aniruddha Das Avatar asked Feb 06 '17 16:02

Aniruddha Das


1 Answers

Step 1. Simply click on the version displayed in the footer of your visual studio code.

Step 2. Then choose Use Workspace version.

You will be good to go.

like image 63
Chathura Gunawardana Avatar answered Sep 18 '22 14:09

Chathura Gunawardana