Skip to content

Missing Date constructor in lib.es2015.core.d.ts #10266

Closed
@life777

Description

@life777

TypeScript Version: 1.8.0

Code

There are 4 Date constructors in ECMAScript 5.1

  1. without anguments: new Date()
  2. with a single integer argument: new Date(200)
  3. with a single string argument: new Date("2016-08-10T22:46:48.160Z")
  4. with 7 integer arguments: new Date(2016, 8, 10, 21, 0, 0, 0);

But in ECMAScript 2015 there is another one:

  1. with a single Date argument: new Date(new Date())
    Link to ECMAScript2015

But this constructor isn't added in lib.es2015.core.d.ts.

Expected behavior:

It should be valid code:

var a = new Date();
var b = new Date(a);

Actual behavior:

There is an error, that a isn't a string or number.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions