Skip to content

Commit

Permalink
Accept generics for defineProperty
Browse files Browse the repository at this point in the history
Both `Object.defineProperty()` and `Object.defineProperties()` return their
first argument. Use a generic so that typings can be passed through.
  • Loading branch information
sirlancelot authored Jan 20, 2021
1 parent 0383b5c commit 213c6c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/es5.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,14 @@ interface ObjectConstructor {
* @param p The property name.
* @param attributes Descriptor for the property. It can be for a data property or an accessor property.
*/
defineProperty(o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType<any>): any;
defineProperty<T>(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType<any>): T;

/**
* Adds one or more properties to an object, and/or modifies attributes of existing properties.
* @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object.
* @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property.
*/
defineProperties(o: any, properties: PropertyDescriptorMap & ThisType<any>): any;
defineProperties<T>(o: T, properties: PropertyDescriptorMap & ThisType<any>): T;

/**
* Prevents the modification of attributes of existing properties, and prevents the addition of new properties.
Expand Down

0 comments on commit 213c6c8

Please sign in to comment.