Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
life777 opened this issue Aug 10, 2016 · 0 comments
Closed

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

life777 opened this issue Aug 10, 2016 · 0 comments
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@life777
Copy link

life777 commented Aug 10, 2016

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.

@yuit yuit added the Bug A bug in TypeScript label Aug 10, 2016
@yuit yuit self-assigned this Aug 10, 2016
@yuit yuit added this to the TypeScript 2.0.1 milestone Aug 11, 2016
@RyanCavanaugh RyanCavanaugh added the Fixed A PR has been merged for this issue label Aug 15, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants