async function f () {
let [res] = await k()
console.log(res.status)
}
async function k (): Promise<[?Object]> {
return [null]
}
will get this strange error message:
let [res] = await k()
^ Cannot call await with `k()` bound to `p` because an indexer property is missing in `Promise` [1].
References:
5: async function k (): Promise<[?Object]> {
^ [1]
But if I change the function order:
async function k (): Promise<[?Object]> {
return [null]
}
async function f () {
let [res] = await k()
console.log(res.status)
}
the message is ok:
``
console.log(res.status)
^ Cannot get
res.statusbecause property
status` is missing in null or undefined [1].
References:
1: async function k (): Promise<[?Object]> {
^ [1]```
I'm getting the same problem and oddly doing await await
seems to work -- but I don't think that should be right. (If you do that in your example above, it works.)
I often have such error and I don't always able to find solution. It's very badly that this bug exists already long ago and developers don't try to fix it. I more and more think to look to Typescript.
@weijarz It's not. It just better fits your needs.
@TrySound ok, I really want to give chance flow
. But sometimes I can鈥檛 understand how it works and why I've an error. Have you got information how then to debug flow
in thouse cases when an error message not enough?
I would find the problem with binary search and rise an issue in this repo. Flow team is more active last few weeks so you will get a response and eventually a fix.
@TrySound I created an issue: https://github.com/facebook/flow/issues/7464
Same error than @weijarz, thanks @scottstraley for your temporary hack.
so what's the status with this issue? Is the suggestion that we use this "temporary hack" with await await
?
Most helpful comment
I'm getting the same problem and oddly doing
await await
seems to work -- but I don't think that should be right. (If you do that in your example above, it works.)