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
|
=== tests/cases/compiler/contextualTypingWithGenericAndNonGenericSignature.ts ===
//• If e is a FunctionExpression or ArrowFunctionExpression with no type parameters and no parameter or return type annotations, and T is a function type with EXACTLY ONE non - generic call signature, then any inferences made for type parameters referenced by the parameters of T’s call signature are fixed(section 4.12.2) and e is processed with the contextual type T, as described in section 4.9.3.
var f2: {
>f2 : Symbol(f2, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 2, 3))
(x: string, y: number): string;
>x : Symbol(x, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 3, 5))
>y : Symbol(y, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 3, 15))
<T, U>(x: T, y: U): T
>T : Symbol(T, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 4, 5))
>U : Symbol(U, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 4, 7))
>x : Symbol(x, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 4, 11))
>T : Symbol(T, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 4, 5))
>y : Symbol(y, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 4, 16))
>U : Symbol(U, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 4, 7))
>T : Symbol(T, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 4, 5))
};
f2 = (x, y) => { return x }
>f2 : Symbol(f2, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 2, 3))
>x : Symbol(x, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 7, 6))
>y : Symbol(y, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 7, 8))
>x : Symbol(x, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 7, 6))
var f3: {
>f3 : Symbol(f3, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 9, 3))
<T, U>(x: T, y: U): T
>T : Symbol(T, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 10, 5))
>U : Symbol(U, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 10, 7))
>x : Symbol(x, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 10, 11))
>T : Symbol(T, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 10, 5))
>y : Symbol(y, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 10, 16))
>U : Symbol(U, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 10, 7))
>T : Symbol(T, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 10, 5))
(x: string, y: number): string;
>x : Symbol(x, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 11, 5))
>y : Symbol(y, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 11, 15))
};
f3 = (x, y) => { return x }
>f3 : Symbol(f3, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 9, 3))
>x : Symbol(x, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 14, 6))
>y : Symbol(y, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 14, 8))
>x : Symbol(x, Decl(contextualTypingWithGenericAndNonGenericSignature.ts, 14, 6))
|