Skip to content
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

lib.es5.d.ts: Date#toGMTString declaration is missing #13622

Closed
ikokostya opened this issue Jan 22, 2017 · 6 comments
Closed

lib.es5.d.ts: Date#toGMTString declaration is missing #13622

ikokostya opened this issue Jan 22, 2017 · 6 comments
Labels
Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Revisit An issue worth coming back to Suggestion An idea for TypeScript

Comments

@ikokostya
Copy link
Contributor

ikokostya commented Jan 22, 2017

TypeScript Version: 2.2.0-dev.20170117

Code

(new Date()).toGMTString();

Expected behavior:

No errors.

Actual behavior:

Error: Property 'toGMTString' does not exist on type 'Date'.

MDN link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toGMTString

This method is deprecated, but still available in browsers and Node.js.

@blakeembrey
Copy link
Contributor

blakeembrey commented Jan 22, 2017

Note: toGMTString() is deprecated and should no longer be used. It remains implemented only for backward compatibility; please use toUTCString() instead.

Why not use the non-deprecated method instead?

@ikokostya
Copy link
Contributor Author

Why not just use the non-deprecated method instead?

I use. But, anyway I think, that this method should be declared, because it's available from JavaScript.

@saschanaz
Copy link
Contributor

You can manually do:

interface Date {
  toGMTString(): string;
}

@ikokostya
Copy link
Contributor Author

ikokostya commented Jan 23, 2017

@saschanaz Issue about missing declaration in lib.es5.d.ts. I known how it may be fixed locally, thanks.

@mhegazy
Copy link
Contributor

mhegazy commented Jan 23, 2017

The method is intentionally redacted from the declaration file as it has since been removed from the standard. The lib files are commutative, i.e. lib.es2015.d.ts includes lib.es5.d.t.s.

From a correctness point of view, the API should be included, but marked as deprecated. We can revisit this after #390 is supported.

@mhegazy mhegazy added Suggestion An idea for TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Revisit An issue worth coming back to labels Jan 23, 2017
@RyanCavanaugh
Copy link
Member

Declining due to lack of other feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Revisit An issue worth coming back to Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

5 participants