From a123fc5ce478b6b314a10454e95e3bbf4a69171d Mon Sep 17 00:00:00 2001 From: ExE Boss <3889017+ExE-Boss@users.noreply.github.com> Date: Wed, 10 Aug 2022 00:05:33 +0200 Subject: [PATCH] =?UTF-8?q?feat(lib/es2015):=20Add=C2=A0typed=C2=A0overloa?= =?UTF-8?q?ds=20to=C2=A0`Reflect`=20(#35608)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> --- src/lib/es2015.reflect.d.ts | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/lib/es2015.reflect.d.ts b/src/lib/es2015.reflect.d.ts index ed968dc0b1740..4f4ddc404f02f 100644 --- a/src/lib/es2015.reflect.d.ts +++ b/src/lib/es2015.reflect.d.ts @@ -6,6 +6,11 @@ declare namespace Reflect { * @param thisArgument The object to be used as the this object. * @param argumentsList An array of argument values to be passed to the function. */ + function apply( + target: (this: T, ...args: A) => R, + thisArgument: T, + argumentsList: Readonly, + ): R; function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; /** @@ -15,6 +20,11 @@ declare namespace Reflect { * @param argumentsList An array of argument values to be passed to the constructor. * @param newTarget The constructor to be used as the `new.target` object. */ + function construct( + target: new (...args: A) => R, + argumentsList: Readonly, + newTarget?: new (...args: any) => any, + ): R; function construct(target: Function, argumentsList: ArrayLike, newTarget?: Function): any; /** @@ -41,7 +51,11 @@ declare namespace Reflect { * @param receiver The reference to use as the `this` value in the getter function, * if `target[propertyKey]` is an accessor property. */ - function get(target: object, propertyKey: PropertyKey, receiver?: any): any; + function get( + target: T, + propertyKey: P, + receiver?: unknown, + ): P extends keyof T ? T[P] : any; /** * Gets the own property descriptor of the specified object. @@ -49,7 +63,10 @@ declare namespace Reflect { * @param target Object that contains the property. * @param propertyKey The property name. */ - function getOwnPropertyDescriptor(target: object, propertyKey: PropertyKey): PropertyDescriptor | undefined; + function getOwnPropertyDescriptor( + target: T, + propertyKey: P, + ): TypedPropertyDescriptor

| undefined; /** * Returns the prototype of an object. @@ -91,6 +108,12 @@ declare namespace Reflect { * @param receiver The reference to use as the `this` value in the setter function, * if `target[propertyKey]` is an accessor property. */ + function set( + target: T, + propertyKey: P, + value: P extends keyof T ? T[P] : any, + receiver?: any, + ): boolean; function set(target: object, propertyKey: PropertyKey, value: any, receiver?: any): boolean; /**