How to get unixtime with typescript

typescript

Solution

Use the `+` operator to explicitly convert to a number:

var x = +new Date / 1000;

Or just use the faster / clearer method `Date#now`:

var x = Date.now() / 1000;

Problem

I tried below. `var unixtime = new Date / 1000;` then, compilation error occured. `error TS2113: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.` How to get unixtime with no compilation error ?

Original source