|
| 1 | +/// <reference no-default-lib="true"/> |
| 2 | + |
1 | 3 | type First<T> = T extends [any] ? T[0] : unknown;
|
2 | 4 |
|
3 | 5 | type UnionToIntersection<T> = (
|
@@ -271,6 +273,48 @@ interface CallableFunction extends Function {
|
271 | 273 | ): (...args: B) => R;
|
272 | 274 | }
|
273 | 275 |
|
| 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 | + |
274 | 318 | interface IArguments {
|
275 | 319 | [index: number]: unknown;
|
276 | 320 | length: number;
|
|
0 commit comments