38 lines
740 B
Text
38 lines
740 B
Text
=== tests/cases/compiler/inferenceFromParameterlessLambda.ts ===
|
|
function foo<T>(o: Take<T>, i: Make<T>) { }
|
|
>foo : <T>(o: Take<T>, i: Make<T>) => void
|
|
>T : T
|
|
>o : Take<T>
|
|
>Take : Take<T>
|
|
>T : T
|
|
>i : Make<T>
|
|
>Make : Make<T>
|
|
>T : T
|
|
|
|
interface Make<T> {
|
|
>Make : Make<T>
|
|
>T : T
|
|
|
|
(): T;
|
|
>T : T
|
|
}
|
|
interface Take<T> {
|
|
>Take : Take<T>
|
|
>T : T
|
|
|
|
(n: T): void;
|
|
>n : T
|
|
>T : T
|
|
}
|
|
// Infer string from second argument because it isn't context sensitive
|
|
foo(n => n.length, () => 'hi');
|
|
>foo(n => n.length, () => 'hi') : void
|
|
>foo : <T>(o: Take<T>, i: Make<T>) => void
|
|
>n => n.length : (n: string) => number
|
|
>n : string
|
|
>n.length : number
|
|
>n : string
|
|
>length : number
|
|
>() => 'hi' : () => string
|
|
>'hi' : string
|
|
|