Closed facundocabrera closed 7 years ago
yes I totally agree, this was planned but didn't get around to it yet, fancy making a PR? The check should be something like:
input !== null && typeof input === 'object' && typeof input.then === 'function'
I'll love to send a PR, but need to check where should I need to do change.
For now what I did was:
type Thenable = {
then: Function
};
function () :Thenable {
... do something ...
}
And as you can imagine, Map, Set, WeakMap, and so on, can have similar scenarios. Is there any plan to define the interfaces for these types? This is something I'm little worry in order to be confident to use this project.
I'd like to get to this in v4. The plan is to parse flow's .flowconfig
to discover interface definitions in the same way that flow does, but it's a lot of work.
I could also see it being valuable to check for the result value of the Promise, e.g. a Promise<string>
could validate that it actually resolves to a string
.
This project is now deprecated in favour of https://codemix.github.io/flow-runtime which has much better support for Flow, I opened a corresponding issue here: https://github.com/codemix/flow-runtime/issues/3
Hey!
I found myself stuck having this issue, I highly recommend to change the snippet generated for Promise instance checking with something more "intelligent", maybe just doing a "thenable" check is enough.
What do you think?