Infer Function return type