juwiley juwiley - 7 months ago 93
Javascript Question

Using Promise as return type in Flow

I'm using Flow 0.30.0. I have a function that returns a promise

function process(callback:Function):Promise {
return new Promise((r,re) => callback)

Flow errors, complaining

function process(callback:Function):Promise {
^^^^^^^ Promise. Application of polymorphic type needs <list of 1 argument>. (Can use `*` for inferrable ones)

This works in tryflow, but not locally. Any ideas of the issue?


According to the flow changelog there was a change introduced in v0.28.0 which made type arguments explicit. Explicitly setting the return type to Promise<any> should fix your issue.

Alternatively you can set the following flag to false, although this is a temporary flag which will be removed in the future