Object.getOwnPropertyDescriptor() returns 'undefined' if property descriptor not found. (#18148)

This commit is contained in:
Alex Chugaev 2017-09-07 20:58:05 +03:00 committed by Mohamed Hegazy
parent c1f2afd645
commit de313ff1bd
3 changed files with 3 additions and 3 deletions

View File

@ -327,7 +327,7 @@ interface ObjectConstructor {
* @param o Object that contains the property.
* @param p Name of the property.
*/
getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor;
getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor | undefined;
/**
* Adds a property to an object, or modifies attributes of an existing property.

View File

@ -4,7 +4,7 @@ declare namespace Reflect {
function defineProperty(target: object, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
function deleteProperty(target: object, propertyKey: PropertyKey): boolean;
function get(target: object, propertyKey: PropertyKey, receiver?: any): any;
function getOwnPropertyDescriptor(target: object, propertyKey: PropertyKey): PropertyDescriptor;
function getOwnPropertyDescriptor(target: object, propertyKey: PropertyKey): PropertyDescriptor | undefined;
function getPrototypeOf(target: object): object;
function has(target: object, propertyKey: PropertyKey): boolean;
function isExtensible(target: object): boolean;

2
src/lib/es5.d.ts vendored
View File

@ -127,7 +127,7 @@ interface ObjectConstructor {
* @param o Object that contains the property.
* @param p Name of the property.
*/
getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor;
getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor | undefined;
/**
* Returns the names of the own properties of an object. The own properties of an object are those that are defined directly