AsyncApi inferring types strangely
Zombiefruit opened this issue · comments
Here's a stripped down example: here.
Not sure exactly what is happening here, but something seems to be getting lost in translation.
new Promise(() => false)
?
you mean Promise.resolve(false)
?
new Promise(() => false)
?
you meanPromise.resolve(false)
?
I don't know what's wrong with me, I keep thinking I can do this. Anyhow, Promise.resolve(false)
works but new Promise((res) => res(false))
doesn't.
If you use new Promise
, you need to give it an explicit type parameter- new Promise<boolean>
.
There's a separate bug in the inference there, where it infers Promise<false> | Promise<true>
. So that's probably a bug.
Ah, makes sense. Okay, closing.
there's the separate issue... I'll have a PR soon