Skip to content

Commit 3a608b7

Browse files
NewableFunction
1 parent 00e7d6e commit 3a608b7

6 files changed

+54
-1
lines changed

build/replacement.ts

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const replacement = new Map([
55
"eval",
66
"ObjectConstructor",
77
"CallableFunction",
8+
"NewableFunction",
89
"IArguments",
910
"JSON",
1011
"ArrayConstructor",

lib/lib.es2015.collection.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/// <reference no-default-lib="true"/>
2+
13
interface Map<K, V> {
24
clear(): void;
35
delete(key: K): boolean;

lib/lib.es2015.core.d.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/// <reference no-default-lib="true"/>
2+
13
interface NumberConstructor {
24
/**
35
* The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1
@@ -93,7 +95,7 @@ interface ObjectConstructor {
9395
* @param value1 The first value.
9496
* @param value2 The second value.
9597
*/
96-
is(value1: any, value2: any): boolean;
98+
is<T>(value1: T, value2: T): boolean;
9799

98100
/**
99101
* Sets the prototype of a specified object o to object proto or null. Returns the object o.

lib/lib.es2022.object.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/// <reference no-default-lib="true"/>
2+
13
interface ObjectConstructor {
24
/**
35
* Determines whether an object has a property with the specified name.

lib/lib.es5.d.ts

+44
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/// <reference no-default-lib="true"/>
2+
13
type First<T> = T extends [any] ? T[0] : unknown;
24

35
type UnionToIntersection<T> = (
@@ -271,6 +273,48 @@ interface CallableFunction extends Function {
271273
): (...args: B) => R;
272274
}
273275

276+
interface NewableFunction extends Function {
277+
/**
278+
* Calls the function with the specified object as the this value and the elements of specified array as the arguments.
279+
* @param thisArg The object to be used as the this object.
280+
*/
281+
apply<T>(this: new () => T, thisArg: T): void;
282+
283+
/**
284+
* Calls the function with the specified object as the this value and the elements of specified array as the arguments.
285+
* @param thisArg The object to be used as the this object.
286+
* @param args An array of argument values to be passed to the function.
287+
*/
288+
apply<T, A extends any[]>(
289+
this: new (...args: A) => T,
290+
thisArg: T,
291+
args: A
292+
): void;
293+
294+
/**
295+
* Calls the function with the specified object as the this value and the specified rest arguments as the arguments.
296+
* @param thisArg The object to be used as the this object.
297+
* @param args Argument values to be passed to the function.
298+
*/
299+
call<T, A extends any[]>(
300+
this: new (...args: A) => T,
301+
thisArg: T,
302+
...args: A
303+
): void;
304+
305+
/**
306+
* For a given function, creates a bound function that has the same body as the original function.
307+
* The this object of the bound function is associated with the specified object, and has the specified initial parameters.
308+
* @param thisArg The object to be used as the this object.
309+
* @param args Arguments to bind to the parameters of the function.
310+
*/
311+
bind<A extends readonly any[], B extends readonly any[], R>(
312+
this: new (...args: [...A, ...B]) => R,
313+
thisArg: any,
314+
...args: A
315+
): new (...args: B) => R;
316+
}
317+
274318
interface IArguments {
275319
[index: number]: unknown;
276320
length: number;

lib/lib.util.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/// <reference no-default-lib="true"/>
2+
13
type First<T> = T extends [any] ? T[0] : unknown;
24

35
type UnionToIntersection<T> = (

0 commit comments

Comments
 (0)