Skip to content

Can't minus two Date object #8260

@bennyyip

Description

@bennyyip

TypeScript Version:

1.8.9

Code

"use strict";

let start = new Date()
let end = new Date()
console.log(start - end)

Expected behavior:
print the difference between two date
Actual behavior:
don't compile when compile option noEmitOnError is enabled.
Here is the error message:

app.ts(5,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
app.ts(5,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions