2014-07-13 01:04:16 +02:00
//// [contextualTypingOfLambdaReturnExpression.ts]
function callb ( lam : ( l : number ) => void ) ;
function callb ( lam : ( n : string ) => void ) ;
function callb ( a ) { }
callb ( ( a ) => a . length ) ; // Ok, we choose the second overload because the first one gave us an error when trying to resolve the lambda return type
callb ( ( a ) => { a . length ; } ) ; // Error, we picked the first overload and errored when type checking the lambda body
//// [contextualTypingOfLambdaReturnExpression.js]
2015-02-07 03:45:09 +01:00
function callb ( a ) { }
2014-08-16 00:49:09 +02:00
callb ( function ( a ) { return a . length ; } ) ; // Ok, we choose the second overload because the first one gave us an error when trying to resolve the lambda return type
2015-02-07 05:03:24 +01:00
callb ( function ( a ) { a . length ; } ) ; // Error, we picked the first overload and errored when type checking the lambda body