52 lines
3 KiB
Plaintext
52 lines
3 KiB
Plaintext
=== 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))
|
||
|