TypeScript/tests/cases/compiler/inferenceFromParameterlessLambda.ts

10 lines
230 B
TypeScript

function foo<T>(o: Take<T>, i: Make<T>) { }
interface Make<T> {
(): T;
}
interface Take<T> {
(n: T): void;
}
// Infer string from second argument because it isn't context sensitive
foo(n => n.length, () => 'hi');