mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Revert Function.bind/apply/call this-overloads
This commit is contained in:
Vendored
-3
@@ -215,7 +215,6 @@ 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<T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U;
|
||||
apply(this: Function, thisArg: any, argArray?: any): any;
|
||||
|
||||
/**
|
||||
@@ -223,7 +222,6 @@ interface Function {
|
||||
* @param thisArg The object to be used as the current object.
|
||||
* @param argArray A list of arguments to be passed to the method.
|
||||
*/
|
||||
call<T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): U;
|
||||
call(this: Function, thisArg: any, ...argArray: any[]): any;
|
||||
|
||||
/**
|
||||
@@ -232,7 +230,6 @@ 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<T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): (this: void, ...argArray: any[]) => U;
|
||||
bind(this: Function, thisArg: any, ...argArray: any[]): any;
|
||||
|
||||
prototype: any;
|
||||
|
||||
@@ -5,7 +5,7 @@ tests/cases/compiler/assignmentToObjectAndFunction.ts(8,5): error TS2322: Type '
|
||||
Property 'apply' is missing in type '{}'.
|
||||
tests/cases/compiler/assignmentToObjectAndFunction.ts(29,5): error TS2322: Type 'typeof bad' is not assignable to type 'Function'.
|
||||
Types of property 'apply' are incompatible.
|
||||
Type 'number' is not assignable to type '{ <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }'.
|
||||
Type 'number' is not assignable to type '(this: Function, thisArg: any, argArray?: any) => any'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentToObjectAndFunction.ts (3 errors) ====
|
||||
@@ -48,4 +48,4 @@ tests/cases/compiler/assignmentToObjectAndFunction.ts(29,5): error TS2322: Type
|
||||
~~~~~~~~~~
|
||||
!!! error TS2322: Type 'typeof bad' is not assignable to type 'Function'.
|
||||
!!! error TS2322: Types of property 'apply' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type '{ <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type '(this: Function, thisArg: any, argArray?: any) => any'.
|
||||
@@ -10,9 +10,9 @@ class C {
|
||||
|
||||
var fn = async () => await other.apply(this, arguments);
|
||||
>fn : Symbol(fn, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 3, 9))
|
||||
>other.apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>other.apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --))
|
||||
>other : Symbol(other, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 1, 13))
|
||||
>apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --))
|
||||
>this : Symbol(C, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 0, 0))
|
||||
>arguments : Symbol(arguments)
|
||||
}
|
||||
|
||||
@@ -9,13 +9,13 @@ class C {
|
||||
>other : () => void
|
||||
|
||||
var fn = async () => await other.apply(this, arguments);
|
||||
>fn : () => Promise<void>
|
||||
>async () => await other.apply(this, arguments) : () => Promise<void>
|
||||
>await other.apply(this, arguments) : void
|
||||
>other.apply(this, arguments) : void
|
||||
>other.apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
|
||||
>fn : () => Promise<any>
|
||||
>async () => await other.apply(this, arguments) : () => Promise<any>
|
||||
>await other.apply(this, arguments) : any
|
||||
>other.apply(this, arguments) : any
|
||||
>other.apply : (this: Function, thisArg: any, argArray?: any) => any
|
||||
>other : () => void
|
||||
>apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
|
||||
>apply : (this: Function, thisArg: any, argArray?: any) => any
|
||||
>this : this
|
||||
>arguments : IArguments
|
||||
}
|
||||
|
||||
@@ -68,9 +68,9 @@ export async function runSampleWorks<A, B, C, D, E>(
|
||||
>T : Symbol(T, Decl(declarationEmitPromise.ts, 8, 16))
|
||||
|
||||
f.apply(this, result);
|
||||
>f.apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>f.apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --))
|
||||
>f : Symbol(f, Decl(declarationEmitPromise.ts, 8, 19))
|
||||
>apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --))
|
||||
>result : Symbol(result, Decl(declarationEmitPromise.ts, 7, 7))
|
||||
|
||||
let rfunc: typeof func & {} = func as any; // <- This is the only difference
|
||||
@@ -140,9 +140,9 @@ export async function runSampleBreaks<A, B, C, D, E>(
|
||||
>T : Symbol(T, Decl(declarationEmitPromise.ts, 17, 16))
|
||||
|
||||
f.apply(this, result);
|
||||
>f.apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>f.apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --))
|
||||
>f : Symbol(f, Decl(declarationEmitPromise.ts, 17, 19))
|
||||
>apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --))
|
||||
>result : Symbol(result, Decl(declarationEmitPromise.ts, 16, 7))
|
||||
|
||||
let rfunc: typeof func = func as any; // <- This is the only difference
|
||||
|
||||
@@ -78,10 +78,10 @@ export async function runSampleWorks<A, B, C, D, E>(
|
||||
>T : T
|
||||
|
||||
f.apply(this, result);
|
||||
>f.apply(this, result) : T
|
||||
>f.apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
|
||||
>f.apply(this, result) : any
|
||||
>f.apply : (this: Function, thisArg: any, argArray?: any) => any
|
||||
>f : (a: A, b?: B, c?: C, d?: D, e?: E) => T
|
||||
>apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
|
||||
>apply : (this: Function, thisArg: any, argArray?: any) => any
|
||||
>this : any
|
||||
>result : any
|
||||
|
||||
@@ -163,10 +163,10 @@ export async function runSampleBreaks<A, B, C, D, E>(
|
||||
>T : T
|
||||
|
||||
f.apply(this, result);
|
||||
>f.apply(this, result) : T
|
||||
>f.apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
|
||||
>f.apply(this, result) : any
|
||||
>f.apply : (this: Function, thisArg: any, argArray?: any) => any
|
||||
>f : (a: A, b?: B, c?: C, d?: D, e?: E) => T
|
||||
>apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
|
||||
>apply : (this: Function, thisArg: any, argArray?: any) => any
|
||||
>this : any
|
||||
>result : any
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ function fn(x = () => this, y = x()) {
|
||||
}
|
||||
|
||||
fn.call(4); // Should be 4
|
||||
>fn.call : Symbol(Function.call, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>fn.call : Symbol(Function.call, Decl(lib.d.ts, --, --))
|
||||
>fn : Symbol(fn, Decl(fatarrowfunctionsInFunctionParameterDefaults.ts, 0, 0))
|
||||
>call : Symbol(Function.call, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>call : Symbol(Function.call, Decl(lib.d.ts, --, --))
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ function fn(x = () => this, y = x()) {
|
||||
|
||||
fn.call(4); // Should be 4
|
||||
>fn.call(4) : any
|
||||
>fn.call : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): U; (this: Function, thisArg: any, ...argArray: any[]): any; }
|
||||
>fn.call : (this: Function, thisArg: any, ...argArray: any[]) => any
|
||||
>fn : (x?: () => any, y?: any) => any
|
||||
>call : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): U; (this: Function, thisArg: any, ...argArray: any[]): any; }
|
||||
>call : (this: Function, thisArg: any, ...argArray: any[]) => any
|
||||
>4 : number
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ function salt() {}
|
||||
>salt : Symbol(salt, Decl(functionType.ts, 0, 0))
|
||||
|
||||
salt.apply("hello", []);
|
||||
>salt.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>salt.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
|
||||
>salt : Symbol(salt, Decl(functionType.ts, 0, 0))
|
||||
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
|
||||
|
||||
(new Function("return 5"))();
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
@@ -3,10 +3,10 @@ function salt() {}
|
||||
>salt : () => void
|
||||
|
||||
salt.apply("hello", []);
|
||||
>salt.apply("hello", []) : void
|
||||
>salt.apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
|
||||
>salt.apply("hello", []) : any
|
||||
>salt.apply : (this: Function, thisArg: any, argArray?: any) => any
|
||||
>salt : () => void
|
||||
>apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
|
||||
>apply : (this: Function, thisArg: any, argArray?: any) => any
|
||||
>"hello" : string
|
||||
>[] : undefined[]
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ function compose<A, B, C>(f: (b: B) => C, g: (a:A) => B): (a:A) => C {
|
||||
|
||||
return f(g.apply(null, a));
|
||||
>f : Symbol(f, Decl(genericTypeParameterEquivalence2.ts, 1, 26))
|
||||
>g.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>g.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
|
||||
>g : Symbol(g, Decl(genericTypeParameterEquivalence2.ts, 1, 41))
|
||||
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
|
||||
>a : Symbol(a, Decl(genericTypeParameterEquivalence2.ts, 2, 21))
|
||||
|
||||
};
|
||||
|
||||
@@ -26,10 +26,10 @@ function compose<A, B, C>(f: (b: B) => C, g: (a:A) => B): (a:A) => C {
|
||||
return f(g.apply(null, a));
|
||||
>f(g.apply(null, a)) : C
|
||||
>f : (b: B) => C
|
||||
>g.apply(null, a) : B
|
||||
>g.apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
|
||||
>g.apply(null, a) : any
|
||||
>g.apply : (this: Function, thisArg: any, argArray?: any) => any
|
||||
>g : (a: A) => B
|
||||
>apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
|
||||
>apply : (this: Function, thisArg: any, argArray?: any) => any
|
||||
>null : null
|
||||
>a : A
|
||||
|
||||
|
||||
@@ -26,39 +26,39 @@ function apply(func, thisArg, args) {
|
||||
>length : Symbol(length, Decl(_apply.js, 12, 7))
|
||||
|
||||
case 0: return func.call(thisArg);
|
||||
>func.call : Symbol(Function.call, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>func.call : Symbol(Function.call, Decl(lib.d.ts, --, --))
|
||||
>func : Symbol(func, Decl(_apply.js, 11, 15))
|
||||
>call : Symbol(Function.call, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>call : Symbol(Function.call, Decl(lib.d.ts, --, --))
|
||||
>thisArg : Symbol(thisArg, Decl(_apply.js, 11, 20))
|
||||
|
||||
case 1: return func.call(thisArg, args[0]);
|
||||
>func.call : Symbol(Function.call, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>func.call : Symbol(Function.call, Decl(lib.d.ts, --, --))
|
||||
>func : Symbol(func, Decl(_apply.js, 11, 15))
|
||||
>call : Symbol(Function.call, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>call : Symbol(Function.call, Decl(lib.d.ts, --, --))
|
||||
>thisArg : Symbol(thisArg, Decl(_apply.js, 11, 20))
|
||||
>args : Symbol(args, Decl(_apply.js, 11, 29))
|
||||
|
||||
case 2: return func.call(thisArg, args[0], args[1]);
|
||||
>func.call : Symbol(Function.call, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>func.call : Symbol(Function.call, Decl(lib.d.ts, --, --))
|
||||
>func : Symbol(func, Decl(_apply.js, 11, 15))
|
||||
>call : Symbol(Function.call, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>call : Symbol(Function.call, Decl(lib.d.ts, --, --))
|
||||
>thisArg : Symbol(thisArg, Decl(_apply.js, 11, 20))
|
||||
>args : Symbol(args, Decl(_apply.js, 11, 29))
|
||||
>args : Symbol(args, Decl(_apply.js, 11, 29))
|
||||
|
||||
case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
||||
>func.call : Symbol(Function.call, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>func.call : Symbol(Function.call, Decl(lib.d.ts, --, --))
|
||||
>func : Symbol(func, Decl(_apply.js, 11, 15))
|
||||
>call : Symbol(Function.call, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>call : Symbol(Function.call, Decl(lib.d.ts, --, --))
|
||||
>thisArg : Symbol(thisArg, Decl(_apply.js, 11, 20))
|
||||
>args : Symbol(args, Decl(_apply.js, 11, 29))
|
||||
>args : Symbol(args, Decl(_apply.js, 11, 29))
|
||||
>args : Symbol(args, Decl(_apply.js, 11, 29))
|
||||
}
|
||||
return func.apply(thisArg, args);
|
||||
>func.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>func.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
|
||||
>func : Symbol(func, Decl(_apply.js, 11, 15))
|
||||
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
|
||||
>thisArg : Symbol(thisArg, Decl(_apply.js, 11, 20))
|
||||
>args : Symbol(args, Decl(_apply.js, 11, 29))
|
||||
}
|
||||
|
||||
@@ -28,17 +28,17 @@ function apply(func, thisArg, args) {
|
||||
case 0: return func.call(thisArg);
|
||||
>0 : number
|
||||
>func.call(thisArg) : any
|
||||
>func.call : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): U; (this: Function, thisArg: any, ...argArray: any[]): any; }
|
||||
>func.call : (this: Function, thisArg: any, ...argArray: any[]) => any
|
||||
>func : Function
|
||||
>call : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): U; (this: Function, thisArg: any, ...argArray: any[]): any; }
|
||||
>call : (this: Function, thisArg: any, ...argArray: any[]) => any
|
||||
>thisArg : any
|
||||
|
||||
case 1: return func.call(thisArg, args[0]);
|
||||
>1 : number
|
||||
>func.call(thisArg, args[0]) : any
|
||||
>func.call : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): U; (this: Function, thisArg: any, ...argArray: any[]): any; }
|
||||
>func.call : (this: Function, thisArg: any, ...argArray: any[]) => any
|
||||
>func : Function
|
||||
>call : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): U; (this: Function, thisArg: any, ...argArray: any[]): any; }
|
||||
>call : (this: Function, thisArg: any, ...argArray: any[]) => any
|
||||
>thisArg : any
|
||||
>args[0] : any
|
||||
>args : any[]
|
||||
@@ -47,9 +47,9 @@ function apply(func, thisArg, args) {
|
||||
case 2: return func.call(thisArg, args[0], args[1]);
|
||||
>2 : number
|
||||
>func.call(thisArg, args[0], args[1]) : any
|
||||
>func.call : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): U; (this: Function, thisArg: any, ...argArray: any[]): any; }
|
||||
>func.call : (this: Function, thisArg: any, ...argArray: any[]) => any
|
||||
>func : Function
|
||||
>call : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): U; (this: Function, thisArg: any, ...argArray: any[]): any; }
|
||||
>call : (this: Function, thisArg: any, ...argArray: any[]) => any
|
||||
>thisArg : any
|
||||
>args[0] : any
|
||||
>args : any[]
|
||||
@@ -61,9 +61,9 @@ function apply(func, thisArg, args) {
|
||||
case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
||||
>3 : number
|
||||
>func.call(thisArg, args[0], args[1], args[2]) : any
|
||||
>func.call : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): U; (this: Function, thisArg: any, ...argArray: any[]): any; }
|
||||
>func.call : (this: Function, thisArg: any, ...argArray: any[]) => any
|
||||
>func : Function
|
||||
>call : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): U; (this: Function, thisArg: any, ...argArray: any[]): any; }
|
||||
>call : (this: Function, thisArg: any, ...argArray: any[]) => any
|
||||
>thisArg : any
|
||||
>args[0] : any
|
||||
>args : any[]
|
||||
@@ -77,9 +77,9 @@ function apply(func, thisArg, args) {
|
||||
}
|
||||
return func.apply(thisArg, args);
|
||||
>func.apply(thisArg, args) : any
|
||||
>func.apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
|
||||
>func.apply : (this: Function, thisArg: any, argArray?: any) => any
|
||||
>func : Function
|
||||
>apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
|
||||
>apply : (this: Function, thisArg: any, argArray?: any) => any
|
||||
>thisArg : any
|
||||
>args : any[]
|
||||
}
|
||||
|
||||
+4
-4
@@ -20,9 +20,9 @@ var r2b: (x: any, y?: any) => any = i.apply;
|
||||
>r2b : Symbol(r2b, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 9, 3))
|
||||
>x : Symbol(x, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 9, 10))
|
||||
>y : Symbol(y, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 9, 17))
|
||||
>i.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>i.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
|
||||
>i : Symbol(i, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 7, 3))
|
||||
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
|
||||
|
||||
var b: {
|
||||
>b : Symbol(b, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 11, 3))
|
||||
@@ -38,7 +38,7 @@ var rb4: (x: any, y?: any) => any = b.apply;
|
||||
>rb4 : Symbol(rb4, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 16, 3))
|
||||
>x : Symbol(x, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 16, 10))
|
||||
>y : Symbol(y, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 16, 17))
|
||||
>b.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>b.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
|
||||
>b : Symbol(b, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 11, 3))
|
||||
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ var r2b: (x: any, y?: any) => any = i.apply;
|
||||
>r2b : (x: any, y?: any) => any
|
||||
>x : any
|
||||
>y : any
|
||||
>i.apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
|
||||
>i.apply : (this: Function, thisArg: any, argArray?: any) => any
|
||||
>i : I
|
||||
>apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
|
||||
>apply : (this: Function, thisArg: any, argArray?: any) => any
|
||||
|
||||
var b: {
|
||||
>b : () => void
|
||||
@@ -40,7 +40,7 @@ var rb4: (x: any, y?: any) => any = b.apply;
|
||||
>rb4 : (x: any, y?: any) => any
|
||||
>x : any
|
||||
>y : any
|
||||
>b.apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
|
||||
>b.apply : (this: Function, thisArg: any, argArray?: any) => any
|
||||
>b : () => void
|
||||
>apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
|
||||
>apply : (this: Function, thisArg: any, argArray?: any) => any
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@ module M1 {
|
||||
>A : Symbol(A, Decl(returnTypeParameterWithModules.ts, 1, 27))
|
||||
|
||||
return Array.prototype.reduce.apply(ar, e ? [f, e] : [f]);
|
||||
>Array.prototype.reduce.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>Array.prototype.reduce.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
|
||||
>Array.prototype.reduce : Symbol(Array.reduce, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>Array.prototype : Symbol(ArrayConstructor.prototype, Decl(lib.d.ts, --, --))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>prototype : Symbol(ArrayConstructor.prototype, Decl(lib.d.ts, --, --))
|
||||
>reduce : Symbol(Array.reduce, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
|
||||
>ar : Symbol(ar, Decl(returnTypeParameterWithModules.ts, 1, 30))
|
||||
>e : Symbol(e, Decl(returnTypeParameterWithModules.ts, 1, 36))
|
||||
>f : Symbol(f, Decl(returnTypeParameterWithModules.ts, 1, 33))
|
||||
|
||||
@@ -13,13 +13,13 @@ module M1 {
|
||||
|
||||
return Array.prototype.reduce.apply(ar, e ? [f, e] : [f]);
|
||||
>Array.prototype.reduce.apply(ar, e ? [f, e] : [f]) : any
|
||||
>Array.prototype.reduce.apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
|
||||
>Array.prototype.reduce.apply : (this: Function, thisArg: any, argArray?: any) => any
|
||||
>Array.prototype.reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; <U>(callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; }
|
||||
>Array.prototype : any[]
|
||||
>Array : ArrayConstructor
|
||||
>prototype : any[]
|
||||
>reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; <U>(callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; }
|
||||
>apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
|
||||
>apply : (this: Function, thisArg: any, argArray?: any) => any
|
||||
>ar : any
|
||||
>e ? [f, e] : [f] : any[]
|
||||
>e : any
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
//// [thisTypeInFunctions2.ts]
|
||||
interface Arguments {
|
||||
init?: (this: void) => void;
|
||||
willDestroy?: (this: any) => void;
|
||||
[propName: string]: number | string | boolean | symbol | undefined | null | {} | ((this: any, ...args:any[]) => any);
|
||||
}
|
||||
declare function extend(arguments: Arguments): void;
|
||||
class Mixin {
|
||||
stuff: number;
|
||||
}
|
||||
|
||||
extend({
|
||||
init() {
|
||||
this
|
||||
},
|
||||
mine: 12,
|
||||
bar() {
|
||||
this.init();
|
||||
},
|
||||
foo() {
|
||||
this.bar;
|
||||
this.url
|
||||
this.handler()
|
||||
this.baz
|
||||
this.willDestroy
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
//// [thisTypeInFunctions2.js]
|
||||
var Mixin = (function () {
|
||||
function Mixin() {
|
||||
}
|
||||
return Mixin;
|
||||
}());
|
||||
extend({
|
||||
init: function () {
|
||||
this;
|
||||
},
|
||||
mine: 12,
|
||||
bar: function () {
|
||||
this.init();
|
||||
},
|
||||
foo: function () {
|
||||
this.bar;
|
||||
this.url;
|
||||
this.handler();
|
||||
this.baz;
|
||||
this.willDestroy;
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,56 @@
|
||||
=== tests/cases/conformance/types/thisType/thisTypeInFunctions2.ts ===
|
||||
interface Arguments {
|
||||
>Arguments : Symbol(Arguments, Decl(thisTypeInFunctions2.ts, 0, 0))
|
||||
|
||||
init?: (this: void) => void;
|
||||
>init : Symbol(Arguments.init, Decl(thisTypeInFunctions2.ts, 0, 21))
|
||||
>this : Symbol(this, Decl(thisTypeInFunctions2.ts, 1, 12))
|
||||
|
||||
willDestroy?: (this: any) => void;
|
||||
>willDestroy : Symbol(Arguments.willDestroy, Decl(thisTypeInFunctions2.ts, 1, 32))
|
||||
>this : Symbol(this, Decl(thisTypeInFunctions2.ts, 2, 19))
|
||||
|
||||
[propName: string]: number | string | boolean | symbol | undefined | null | {} | ((this: any, ...args:any[]) => any);
|
||||
>propName : Symbol(propName, Decl(thisTypeInFunctions2.ts, 3, 5))
|
||||
>this : Symbol(this, Decl(thisTypeInFunctions2.ts, 3, 87))
|
||||
>args : Symbol(args, Decl(thisTypeInFunctions2.ts, 3, 97))
|
||||
}
|
||||
declare function extend(arguments: Arguments): void;
|
||||
>extend : Symbol(extend, Decl(thisTypeInFunctions2.ts, 4, 1))
|
||||
>arguments : Symbol(arguments, Decl(thisTypeInFunctions2.ts, 5, 24))
|
||||
>Arguments : Symbol(Arguments, Decl(thisTypeInFunctions2.ts, 0, 0))
|
||||
|
||||
class Mixin {
|
||||
>Mixin : Symbol(Mixin, Decl(thisTypeInFunctions2.ts, 5, 52))
|
||||
|
||||
stuff: number;
|
||||
>stuff : Symbol(Mixin.stuff, Decl(thisTypeInFunctions2.ts, 6, 13))
|
||||
}
|
||||
|
||||
extend({
|
||||
>extend : Symbol(extend, Decl(thisTypeInFunctions2.ts, 4, 1))
|
||||
|
||||
init() {
|
||||
>init : Symbol(init, Decl(thisTypeInFunctions2.ts, 10, 8))
|
||||
|
||||
this
|
||||
},
|
||||
mine: 12,
|
||||
>mine : Symbol(mine, Decl(thisTypeInFunctions2.ts, 13, 6))
|
||||
|
||||
bar() {
|
||||
>bar : Symbol(bar, Decl(thisTypeInFunctions2.ts, 14, 13))
|
||||
|
||||
this.init();
|
||||
},
|
||||
foo() {
|
||||
>foo : Symbol(foo, Decl(thisTypeInFunctions2.ts, 17, 6))
|
||||
|
||||
this.bar;
|
||||
this.url
|
||||
this.handler()
|
||||
this.baz
|
||||
this.willDestroy
|
||||
}
|
||||
})
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
=== tests/cases/conformance/types/thisType/thisTypeInFunctions2.ts ===
|
||||
interface Arguments {
|
||||
>Arguments : Arguments
|
||||
|
||||
init?: (this: void) => void;
|
||||
>init : (this: void) => void
|
||||
>this : void
|
||||
|
||||
willDestroy?: (this: any) => void;
|
||||
>willDestroy : (this: any) => void
|
||||
>this : any
|
||||
|
||||
[propName: string]: number | string | boolean | symbol | undefined | null | {} | ((this: any, ...args:any[]) => any);
|
||||
>propName : string
|
||||
>null : null
|
||||
>this : any
|
||||
>args : any[]
|
||||
}
|
||||
declare function extend(arguments: Arguments): void;
|
||||
>extend : (arguments: Arguments) => void
|
||||
>arguments : Arguments
|
||||
>Arguments : Arguments
|
||||
|
||||
class Mixin {
|
||||
>Mixin : Mixin
|
||||
|
||||
stuff: number;
|
||||
>stuff : number
|
||||
}
|
||||
|
||||
extend({
|
||||
>extend({ init() { this }, mine: 12, bar() { this.init(); }, foo() { this.bar; this.url this.handler() this.baz this.willDestroy }}) : void
|
||||
>extend : (arguments: Arguments) => void
|
||||
>{ init() { this }, mine: 12, bar() { this.init(); }, foo() { this.bar; this.url this.handler() this.baz this.willDestroy }} : { init(): void; mine: number; bar(): void; foo(): void; }
|
||||
|
||||
init() {
|
||||
>init : () => void
|
||||
|
||||
this
|
||||
>this : void
|
||||
|
||||
},
|
||||
mine: 12,
|
||||
>mine : number
|
||||
>12 : number
|
||||
|
||||
bar() {
|
||||
>bar : () => void
|
||||
|
||||
this.init();
|
||||
>this.init() : any
|
||||
>this.init : any
|
||||
>this : any
|
||||
>init : any
|
||||
|
||||
},
|
||||
foo() {
|
||||
>foo : () => void
|
||||
|
||||
this.bar;
|
||||
>this.bar : any
|
||||
>this : any
|
||||
>bar : any
|
||||
|
||||
this.url
|
||||
>this.url : any
|
||||
>this : any
|
||||
>url : any
|
||||
|
||||
this.handler()
|
||||
>this.handler() : any
|
||||
>this.handler : any
|
||||
>this : any
|
||||
>handler : any
|
||||
|
||||
this.baz
|
||||
>this.baz : any
|
||||
>this : any
|
||||
>baz : any
|
||||
|
||||
this.willDestroy
|
||||
>this.willDestroy : any
|
||||
>this : any
|
||||
>willDestroy : any
|
||||
}
|
||||
})
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
interface Arguments {
|
||||
init?: (this: void) => void;
|
||||
willDestroy?: (this: any) => void;
|
||||
[propName: string]: number | string | boolean | symbol | undefined | null | {} | ((this: any, ...args:any[]) => any);
|
||||
}
|
||||
declare function extend(arguments: Arguments): void;
|
||||
class Mixin {
|
||||
stuff: number;
|
||||
}
|
||||
|
||||
extend({
|
||||
init() {
|
||||
this
|
||||
},
|
||||
mine: 12,
|
||||
bar() {
|
||||
this.init();
|
||||
},
|
||||
foo() {
|
||||
this.bar;
|
||||
this.url
|
||||
this.handler()
|
||||
this.baz
|
||||
this.willDestroy
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user