Repository: TypeScript
Issue: Variable type isn't detected properly even though function's return type is
Labels: Needs Investigation

# Bug Report
I'm witnessing a very peculiar behavior from TypeScript, which is causing me a lot of frustration. I don't seem to be able to figure out what's wrong.
Two identical pieces of code, yet "sometimes", and the variable type is detected properly, and sometimes it's `any`.

![image](https://user-images.githubusercontent.com/26527405/150751092-5fde04ff-bc18-4b9a-b46e-826d26fb0cf7.png)
![image](https://user-images.githubusercontent.com/26527405/150751173-7dac3ee0-fd57-456c-bb7c-fbc76ee56ca0.png)

It may also be worth mentioning that when I use braces `{}` for the anonymous functions above, the type-detection starts working as expected! All of this peculiarity has led me to believe that this must be some sort of a bug.

### ⏯ Playground Link

[Playground link with relevant code](https://www.typescriptlang.org/play?strict=false&noImplicitAny=false&strictNullChecks=false&strictFunctionTypes=false&strictPropertyInitialization=false&strictBindCallApply=false&noImplicitThis=false&noImplicitReturns=false&alwaysStrict=false#code/KYDwDg9gTgLgBASwHY2FAZgQwMbDgBSgjADVMAbBAE0xgQiQFEoio4BvAKDh7gFtgAZ0GYA5sABccQTCjJRAbk4BfTp1CRYiFGiy4CRUhWq1oAHgAqhYgD4O3XgAoAbhQCukuFcMBKKdaNKGjoGZlYlVXVwaHgYAE8wPAB5ACMAK2BsGDIg2nomFmhBS1SMrLsAXnteOABtfG04AGtgOIh0L1LMmABdAH5-QxyTEILwlTUNGO1UDBxk9O7h4PyAJSE3chgSxfLq3gRBZakUiAhyYEwkJRrXXNGwoqkurOW80MKoYosXmBsJqKaWIJPCrTZCHZlP5wKpcACQ9UaLTaHR+u16AwMxDeMHMaKh9R6NgiSkB02Qsz0eBxmBSF0h3TsXFu7iEUnx3RuvCg4MEUjBF2+v2JAKmWnQbiQWXycDuI1p9I55UcPMF-N5DPKABptAg6BQch5BJj8JhYAgKJq-n44DS6cArUzOHCoMAYG4oEh7HC4XcjVJHMg9RbyIahHA+n0OMofHBMIJOuitc6Xbzk3DlBE1AB6bNwAC0hbUFN08y8QhgADFJdKGJYAk6ai5WeyAj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D1YOXhzaIRBNbOAeCHYACYXb1xtk3B0LcbA2x1HHBA2AY7102iwbowizbJAAHLGQAJpwCoOddAaAzL6HNq6V22FaDkLjCwpAcQ4GPjgEjT8CYzR4FvHuPxHEiFaRSFAeYCZ2DKB4YbS88A45xFjpHG8jj4CYHQFYrIzja7mLdN0GUTiKDkD6FJEpHctqI3wdI3uYsYAD1en-AB595CXwfjNXgN8l4ZVXuvXgMYt4jzHofJAGMT6jGaduVpj84Q3z8gFNp8IfRzXvh-Kp39WS-0GXvJQPo+GwwEShIAA)

Please check out the playground. I've written comments explaining the situation. Thank you