Skip to content

TS2362 - Error when doing arithmetic operations on date  #5710

Closed
@erichillah

Description

@erichillah

Hi,
The following valid js code compile with TS2362 error

let start = new Date();
let elapsed = new Date() - start;
index.ts(9,22): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
index.ts(9,37): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.

To avoid the error i need to explicitely cast opreands wit <any>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions