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

Add definition for Object.entries and Object.values in lib.es2017.d.ts #8482

Closed
mhegazy opened this issue May 5, 2016 · 7 comments
Closed
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript ES Next New featurers for ECMAScript (a.k.a. ESNext) Fixed A PR has been merged for this issue

Comments

@mhegazy
Copy link
Contributor

mhegazy commented May 5, 2016

The proposal is at stage 4 now. here is the spec: https://github.com/tc39/proposal-object-values-entries

here is the definition skeleton:

interface ObjectConstructor {
    keys(o: any): string[];
    values<T>(o: { [s: string]: T }): T[];
    values(o: any): any[];
    entries<T>(o: { [s: string]: T }): [string, T][];
    entries(o: any): [string, any][];
}
@mhegazy mhegazy added ES Next New featurers for ECMAScript (a.k.a. ESNext) Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Bug A bug in TypeScript labels May 5, 2016
@mhegazy mhegazy modified the milestone: TypeScript 2.0 May 6, 2016
@yuit yuit added the Fixed A PR has been merged for this issue label May 10, 2016
@michaeljota
Copy link

Hi! Does this gets transpiled to ES5? Or this are just the definitions?

@kitsonk
Copy link
Contributor

kitsonk commented Nov 24, 2016

TypeScript does not polyfill functionality, it only down-emits syntactical constructs. If you want this functionality in ES5, you will need to use an external polyfill library like core-js.

@michaeljota
Copy link

I use core-js already, but the typescript compiler throws when trying to access to values in ObjectConstructor

@kitsonk
Copy link
Contributor

kitsonk commented Nov 24, 2016

Are you using "lib": [ "es2017.object" ]?

@micahblu
Copy link

When I add "lib": [ "es2017.object" ] my code editor now doesn't recognize Object or any other js global?

@kitsonk
Copy link
Contributor

kitsonk commented Jan 11, 2018

I was a little bit unclear, in that once you use "lib", you have to specify all the library files you need. So you would want to have something like "lib": [ "dom", "es2017" ] in which es2017 will load all the built-ins of ES2017, ES2016, ES5 and ES3 as well as the DOM related libraries. When you specify a sub library, it will only load that one.

@micahblu
Copy link

@kitsonk That worked! Thanks Much 👍

@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript ES Next New featurers for ECMAScript (a.k.a. ESNext) Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

5 participants