From c5d19fcd17a0bf79635835bb8d55b2f0071eca95 Mon Sep 17 00:00:00 2001
From: kzyqq00-Player <1561737625@qq.com>
Date: Sat, 9 Nov 2024 07:10:32 +0800
Subject: [PATCH 1/2] Refine the type signatures of the functions apply, call,
and bind.
---
src/lib/es5.d.ts | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts
index ab484e1812e7b..d09a6e17b8872 100644
--- a/src/lib/es5.d.ts
+++ b/src/lib/es5.d.ts
@@ -260,14 +260,14 @@ interface Function {
* @param thisArg The object to be used as the this object.
* @param argArray A set of arguments to be passed to the function.
*/
- apply(this: Function, thisArg: any, argArray?: any): any;
+ apply(this: (...args: A) => R, thisArg: any, argArray?: A): R;
/**
* Calls a method of an object, substituting another object for the current object.
* @param thisArg The object to be used as the current object.
* @param argArray A list of arguments to be passed to the method.
*/
- call(this: Function, thisArg: any, ...argArray: any[]): any;
+ call(this: (...args: A) => R, thisArg: any, ...argArray: A): R;
/**
* For a given function, creates a bound function that has the same body as the original function.
@@ -275,7 +275,7 @@ interface Function {
* @param thisArg An object to which the this keyword can refer inside the new function.
* @param argArray A list of arguments to be passed to the new function.
*/
- bind(this: Function, thisArg: any, ...argArray: any[]): any;
+ bind(this: (...args: A) => R, thisArg: any, ...argArray: A): R;
/** Returns a string representation of a function. */
toString(): string;
From cd477090592f15d29ccf7b37678549d020ef4c96 Mon Sep 17 00:00:00 2001
From: kzyqq00-Player <1561737625@qq.com>
Date: Sat, 9 Nov 2024 08:01:32 +0800
Subject: [PATCH 2/2] Fix bind return type
---
src/lib/es5.d.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts
index d09a6e17b8872..b90a2636be774 100644
--- a/src/lib/es5.d.ts
+++ b/src/lib/es5.d.ts
@@ -275,7 +275,7 @@ interface Function {
* @param thisArg An object to which the this keyword can refer inside the new function.
* @param argArray A list of arguments to be passed to the new function.
*/
- bind(this: (...args: A) => R, thisArg: any, ...argArray: A): R;
+ bind(this: (...args: A) => R, thisArg: any, ...argArray: A): (...args: A) => R;
/** Returns a string representation of a function. */
toString(): string;