Flow: Variable keep being typed as Promise event after async / await

Created on 6 Jul 2018  路  1Comment  路  Source: facebook/flow

Reproduction :
Try it

Context :
When calling a function called 'foo' returning a promise with await, the type of the variable is still Promise.

Flow correctly interprets the value if we just return the variable, but triggers an error if we type the return of the function called 'bar'.

Is there any issue / PR related, or a common workaround ? Casting with any didn't seem to solve the error.

Most helpful comment

The return of the function is a Promise

After await is only T

The behavior is correct

>All comments

The return of the function is a Promise

After await is only T

The behavior is correct

Was this page helpful?
0 / 5 - 0 ratings