forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathjsFileCompilationRestParamJsDocFunction.types
88 lines (80 loc) · 2.38 KB
/
jsFileCompilationRestParamJsDocFunction.types
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
=== tests/cases/compiler/_apply.js ===
/**
* A faster alternative to `Function#apply`, this function invokes `func`
* with the `this` binding of `thisArg` and the arguments of `args`.
*
* @private
* @param {Function} func The function to invoke.
* @param {*} thisArg The `this` binding of `func`.
* @param {...*} args The arguments to invoke `func` with.
* @returns {*} Returns the result of `func`.
*/
function apply(func, thisArg, ...args) {
>apply : (func: Function, thisArg: any, ...args: any[]) => any
>func : Function
>thisArg : any
>args : any[]
var length = args.length;
>length : number
>args.length : number
>args : any[]
>length : number
switch (length) {
>length : number
case 0: return func.call(thisArg);
>0 : 0
>func.call(thisArg) : any
>func.call : (this: Function, thisArg: any, ...argArray: any[]) => any
>func : Function
>call : (this: Function, thisArg: any, ...argArray: any[]) => any
>thisArg : any
case 1: return func.call(thisArg, args[0]);
>1 : 1
>func.call(thisArg, args[0]) : any
>func.call : (this: Function, thisArg: any, ...argArray: any[]) => any
>func : Function
>call : (this: Function, thisArg: any, ...argArray: any[]) => any
>thisArg : any
>args[0] : any
>args : any[]
>0 : 0
case 2: return func.call(thisArg, args[0], args[1]);
>2 : 2
>func.call(thisArg, args[0], args[1]) : any
>func.call : (this: Function, thisArg: any, ...argArray: any[]) => any
>func : Function
>call : (this: Function, thisArg: any, ...argArray: any[]) => any
>thisArg : any
>args[0] : any
>args : any[]
>0 : 0
>args[1] : any
>args : any[]
>1 : 1
case 3: return func.call(thisArg, args[0], args[1], args[2]);
>3 : 3
>func.call(thisArg, args[0], args[1], args[2]) : any
>func.call : (this: Function, thisArg: any, ...argArray: any[]) => any
>func : Function
>call : (this: Function, thisArg: any, ...argArray: any[]) => any
>thisArg : any
>args[0] : any
>args : any[]
>0 : 0
>args[1] : any
>args : any[]
>1 : 1
>args[2] : any
>args : any[]
>2 : 2
}
return func.apply(thisArg, args);
>func.apply(thisArg, args) : any
>func.apply : (this: Function, thisArg: any, argArray?: any) => any
>func : Function
>apply : (this: Function, thisArg: any, argArray?: any) => any
>thisArg : any
>args : any[]
}
export default apply;
>apply : (func: Function, thisArg: any, ...args: any[]) => any