mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 11:24:49 -05:00
Accept generics for defineProperty (#42424)
* Accept generics for defineProperty Both `Object.defineProperty()` and `Object.defineProperties()` return their first argument. Use a generic so that typings can be passed through. * Update baselines * update missed baseline Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
This commit is contained in:
4
src/lib/es5.d.ts
vendored
4
src/lib/es5.d.ts
vendored
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user