Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean .flowconfig so users won't need configuration to use fbjs #182

Merged
merged 5 commits into from
Sep 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions packages/fbjs/flow/lib/Promise.js

This file was deleted.

10 changes: 0 additions & 10 deletions packages/fbjs/flow/lib/dev.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/fbjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"babel-preset-fbjs": "file:../babel-preset-fbjs",
"del": "^2.2.0",
"fbjs-scripts": "file:../fbjs-scripts",
"flow-bin": "^0.28.0",
"flow-bin": "^0.32.0",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2",
"gulp-flatten": "^0.2.0",
Expand Down
9 changes: 1 addition & 8 deletions packages/fbjs/src/.flowconfig
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
[ignore]
.*/__tests__/.*
.*/node_modules/.*

[include]
../node_modules/promise

[libs]
../flow/lib

[options]
module.system=haste

suppress_type=$FlowIssue

[version]
^0.28.0
^0.32.0
11 changes: 10 additions & 1 deletion packages/fbjs/src/core/Deferred.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,16 @@ class Deferred<Tvalue, Treason> {
}

done(): void {
Promise.prototype.done.apply(this._promise, arguments);
// Embed the polyfill for the non-standard Promise.prototype.done so that
// users of the open source fbjs don't need a custom lib for Promise
const promise = arguments.length ?
this._promise.then.apply(this._promise, arguments) :
this._promise;
promise.then(undefined, function(err) {
setTimeout(function() {
throw err;
}, 0);
});
}

isSettled(): boolean {
Expand Down
3 changes: 2 additions & 1 deletion packages/fbjs/src/core/shallowEqual.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ function is(x: mixed, y: mixed): boolean {
// SameValue algorithm
if (x === y) { // Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
return x !== 0 || 1 / (x: $FlowIssue) === 1 / (y: $FlowIssue);
// Added the nonzero y check to make Flow happy, but it is redundant
return x !== 0 || y !== 0 || 1 / x === 1 / y;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this extra inequality check is redundant, but it makes Flow happy. At the moment, Flow doesn't understand that, if x === y, then refining x also refines y.

} else {
// Step 6.a: NaN == NaN
return x !== x && y !== y;
Expand Down