typescript - What does the "=> any" signify? -
in answer this question s/he refers to:
getjson(url: string, success?: (data: any, textstatus: string, jqxhr: jqueryxhr) => any): jqueryxhr;
i understand "success?: (data: any, textstatus: string, jqxhr: jqueryxhr)" part - that's saying there optional function called on success has 3 typed parameters.
but "=> any" signify in this? mean function can return type of object? doesn't make sense success function logically of type void.
thanks - dave
you correct; void
correct way type function's return value.
in practice, there isn't difference between any
, void
return types in callback positions because compiler not enforce functions type of any
have return
statement.
Comments
Post a Comment