fbjs icon indicating copy to clipboard operation
fbjs copied to clipboard

Can we stop using Promise.prototype.done?

Open gabelevi opened this issue 9 years ago • 1 comments

As of Flow v0.23.0, Flow only ships with the standard Promise definition. Users who want to use non-standard Promise APIs need to provide their own Promise lib file.

Currently, fbjs uses Promise.prototype.done() in one place (in Deferred.js). This means when Deferred.js is compiled into Deferred.js.flow it refers to Promise.prototype.done(). Other projects which depend on fbjs will have Flow errors unless they add their own Promise lib file.

I'm sure there are a million workarounds, but it feels to me that the cleanest would be to stop using this nonstandard API. The polyfill looks really short, so Deferred.prototype.done() could just implement done using then.

Happy to send a PR for this if people are ok with it.

gabelevi avatar Apr 16 '16 15:04 gabelevi

I think that's the right thing and fixing the code here should be easy like you say. However since we're syncing from www here, I think the diff there might be more involved. I'm going to ship #137 to solve short term. Let me know if when fix www and we'll sync out and remove what I've done.

zpao avatar Apr 18 '16 18:04 zpao