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

A property descriptor must have keys "enumerable" and "configurable" #35102

Open
zhirzh opened this issue Nov 14, 2019 · 3 comments
Open

A property descriptor must have keys "enumerable" and "configurable" #35102

zhirzh opened this issue Nov 14, 2019 · 3 comments
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript
Milestone

Comments

@zhirzh
Copy link

zhirzh commented Nov 14, 2019

TypeScript Version: 3.7.2

Expected behavior: In a property descriptor object, keys configurable and enumerable should not be optional.

Actual behavior: These properties are marked as optional (see here and here).

@IllusionMH
Copy link
Contributor

Why they should be required?
MDM mentions them as optional https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty#Description

According to latest draft of spec (and previous versions) https://tc39.es/ecma262/#sec-topropertydescriptor explicitly check if these keys are in descriptor object without throwing if they are not available.

@zhirzh
Copy link
Author

zhirzh commented Nov 14, 2019

Yes, you are right on that. I was only comparing the result of Object.getOwnPropertyDescriptor() and concluded that keys configurable and enumerable must be present.

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Nov 14, 2019
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Nov 14, 2019
@RyanCavanaugh RyanCavanaugh added the Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript label Nov 14, 2019
@RyanCavanaugh
Copy link
Member

The return type of Object.getOwnPropertyDescriptor could be more precise by making these non-optional since they're always returned

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants