@@ -2307,6 +2307,77 @@ interface Function {
23072307 /** Returns a string representation of this function. */
23082308 toString ( ) : string ;
23092309}
2310+
2311+ /**
2312+ * Extracts the type of the 'this' parameter of a function type, or 'unknown' if the function type has no 'this' parameter.
2313+ */
2314+ type ThisParameterType < T > = T extends ( this : infer U , ...args : never ) => any ? U : unknown ;
2315+
2316+ /**
2317+ * Removes the 'this' parameter from a function type.
2318+ */
2319+ type OmitThisParameter < T > = unknown extends ThisParameterType < T > ? T : T extends ( ...args : infer A ) => infer R ? ( ...args : A ) => R : T ;
2320+
2321+ interface CallableFunction extends Function {
2322+ /**
2323+ * Calls the function with the specified object as the this value and the elements of specified array as the arguments.
2324+ * @param thisArg The object to be used as the this object.
2325+ * @param args An array of argument values to be passed to the function.
2326+ */
2327+ apply < T , R > ( this : ( this : T ) => R , thisArg : T ) : R ;
2328+ apply < T , A extends any [ ] , R > ( this : ( this : T , ...args : A ) => R , thisArg : T , args : A ) : R ;
2329+
2330+ /**
2331+ * Calls the function with the specified object as the this value and the specified rest arguments as the arguments.
2332+ * @param thisArg The object to be used as the this object.
2333+ * @param args Argument values to be passed to the function.
2334+ */
2335+ call < T , A extends any [ ] , R > ( this : ( this : T , ...args : A ) => R , thisArg : T , ...args : A ) : R ;
2336+
2337+ /**
2338+ * For a given function, creates a bound function that has the same body as the original function.
2339+ * The this object of the bound function is associated with the specified object, and has the specified initial parameters.
2340+ * @param thisArg The object to be used as the this object.
2341+ * @param args Arguments to bind to the parameters of the function.
2342+ */
2343+ bind < T > ( this : T , thisArg : ThisParameterType < T > ) : OmitThisParameter < T > ;
2344+ bind < T , A0 , A extends any [ ] , R > ( this : ( this : T , arg0 : A0 , ...args : A ) => R , thisArg : T , arg0 : A0 ) : ( ...args : A ) => R ;
2345+ bind < T , A0 , A1 , A extends any [ ] , R > ( this : ( this : T , arg0 : A0 , arg1 : A1 , ...args : A ) => R , thisArg : T , arg0 : A0 , arg1 : A1 ) : ( ...args : A ) => R ;
2346+ bind < T , A0 , A1 , A2 , A extends any [ ] , R > ( this : ( this : T , arg0 : A0 , arg1 : A1 , arg2 : A2 , ...args : A ) => R , thisArg : T , arg0 : A0 , arg1 : A1 , arg2 : A2 ) : ( ...args : A ) => R ;
2347+ bind < T , A0 , A1 , A2 , A3 , A extends any [ ] , R > ( this : ( this : T , arg0 : A0 , arg1 : A1 , arg2 : A2 , arg3 : A3 , ...args : A ) => R , thisArg : T , arg0 : A0 , arg1 : A1 , arg2 : A2 , arg3 : A3 ) : ( ...args : A ) => R ;
2348+ bind < T , AX , R > ( this : ( this : T , ...args : AX [ ] ) => R , thisArg : T , ...args : AX [ ] ) : ( ...args : AX [ ] ) => R ;
2349+ }
2350+
2351+ interface NewableFunction extends Function {
2352+ /**
2353+ * Calls the function with the specified object as the this value and the elements of specified array as the arguments.
2354+ * @param thisArg The object to be used as the this object.
2355+ * @param args An array of argument values to be passed to the function.
2356+ */
2357+ apply < T > ( this : new ( ) => T , thisArg : T ) : void ;
2358+ apply < T , A extends any [ ] > ( this : new ( ...args : A ) => T , thisArg : T , args : A ) : void ;
2359+
2360+ /**
2361+ * Calls the function with the specified object as the this value and the specified rest arguments as the arguments.
2362+ * @param thisArg The object to be used as the this object.
2363+ * @param args Argument values to be passed to the function.
2364+ */
2365+ call < T , A extends any [ ] > ( this : new ( ...args : A ) => T , thisArg : T , ...args : A ) : void ;
2366+
2367+ /**
2368+ * For a given function, creates a bound function that has the same body as the original function.
2369+ * The this object of the bound function is associated with the specified object, and has the specified initial parameters.
2370+ * @param thisArg The object to be used as the this object.
2371+ * @param args Arguments to bind to the parameters of the function.
2372+ */
2373+ bind < T > ( this : T , thisArg : any ) : T ;
2374+ bind < A0 , A extends any [ ] , R > ( this : new ( arg0 : A0 , ...args : A ) => R , thisArg : any , arg0 : A0 ) : new ( ...args : A ) => R ;
2375+ bind < A0 , A1 , A extends any [ ] , R > ( this : new ( arg0 : A0 , arg1 : A1 , ...args : A ) => R , thisArg : any , arg0 : A0 , arg1 : A1 ) : new ( ...args : A ) => R ;
2376+ bind < A0 , A1 , A2 , A extends any [ ] , R > ( this : new ( arg0 : A0 , arg1 : A1 , arg2 : A2 , ...args : A ) => R , thisArg : any , arg0 : A0 , arg1 : A1 , arg2 : A2 ) : new ( ...args : A ) => R ;
2377+ bind < A0 , A1 , A2 , A3 , A extends any [ ] , R > ( this : new ( arg0 : A0 , arg1 : A1 , arg2 : A2 , arg3 : A3 , ...args : A ) => R , thisArg : any , arg0 : A0 , arg1 : A1 , arg2 : A2 , arg3 : A3 ) : new ( ...args : A ) => R ;
2378+ bind < AX , R > ( this : new ( ...args : AX [ ] ) => R , thisArg : any , ...args : AX [ ] ) : new ( ...args : AX [ ] ) => R ;
2379+ }
2380+
23102381interface IArguments { }
23112382interface RegExp { }
23122383
0 commit comments