question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make it easier for to use fbjs and flow together

See original GitHub issue

I don’t really know if/how this could be achieved but using flow in a project using any project that uses fbjs make flow throw a lot of errors by default.

Take a simple project that uses react and react-relay. This throws 20 errors on an empty project with an empty .flowconfig

flow check                                                                                                                                      [20:30:35]

/home/christian/relay-flow-starter-kit/node_modules/react-relay/node_modules/fbjs/flow/include/Deferred.js:14:15,32: Promise
Required module not found

/home/christian/relay-flow-starter-kit/node_modules/react-relay/node_modules/fbjs/flow/include/PromiseMap.js:15:16,34: Deferred
Required module not found

/home/christian/relay-flow-starter-kit/node_modules/react-relay/node_modules/fbjs/flow/include/PromiseMap.js:17:17,36: invariant
Required module not found

/home/christian/relay-flow-starter-kit/node_modules/react-relay/node_modules/fbjs/flow/include/PromiseMap.js:19:31,39: Promise
Required module not found

/home/christian/relay-flow-starter-kit/node_modules/react-relay/node_modules/fbjs/flow/include/fetchWithRetries.js:16:28,58: ExecutionEnvironment
Required module not found

/home/christian/relay-flow-starter-kit/node_modules/react-relay/node_modules/fbjs/flow/include/fetchWithRetries.js:17:15,32: Promise
Required module not found

/home/christian/relay-flow-starter-kit/node_modules/react-relay/node_modules/fbjs/flow/include/fetchWithRetries.js:19:15,32: sprintf
Required module not found

/home/christian/relay-flow-starter-kit/node_modules/react-relay/node_modules/fbjs/flow/include/fetchWithRetries.js:20:13,28: fetch
Required module not found

/home/christian/relay-flow-starter-kit/node_modules/react-relay/node_modules/fbjs/flow/include/fetchWithRetries.js:21:15,32: warning
Required module not found

/home/christian/relay-flow-starter-kit/node_modules/react-relay/node_modules/fbjs/flow/include/resolveImmediate.js:13:15,32: Promise
Required module not found

/home/christian/relay-flow-starter-kit/node_modules/react/node_modules/fbjs/flow/include/Deferred.js:14:15,32: Promise
Required module not found

/home/christian/relay-flow-starter-kit/node_modules/react/node_modules/fbjs/flow/include/PromiseMap.js:15:16,34: Deferred
Required module not found

/home/christian/relay-flow-starter-kit/node_modules/react/node_modules/fbjs/flow/include/PromiseMap.js:17:17,36: invariant
Required module not found

/home/christian/relay-flow-starter-kit/node_modules/react/node_modules/fbjs/flow/include/PromiseMap.js:19:31,39: Promise
Required module not found

/home/christian/relay-flow-starter-kit/node_modules/react/node_modules/fbjs/flow/include/fetchWithRetries.js:16:28,58: ExecutionEnvironment
Required module not found

/home/christian/relay-flow-starter-kit/node_modules/react/node_modules/fbjs/flow/include/fetchWithRetries.js:17:15,32: Promise
Required module not found

/home/christian/relay-flow-starter-kit/node_modules/react/node_modules/fbjs/flow/include/fetchWithRetries.js:19:15,32: sprintf
Required module not found

/home/christian/relay-flow-starter-kit/node_modules/react/node_modules/fbjs/flow/include/fetchWithRetries.js:20:13,28: fetch
Required module not found

/home/christian/relay-flow-starter-kit/node_modules/react/node_modules/fbjs/flow/include/fetchWithRetries.js:21:15,32: warning
Required module not found

/home/christian/relay-flow-starter-kit/node_modules/react/node_modules/fbjs/flow/include/resolveImmediate.js:13:15,32: Promise
Required module not found

Found 20 errors

I can fix these error by mimicking the relay’s .flowconfig but this gets really cumbersome. Is there anything that can be done to improve on this situation?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sophiebitscommented, Sep 30, 2015

Yes, @gabelevi is working on a solution to this since we need it at FB too.

0reactions
bochen2014commented, May 30, 2017

I had the same issue with -- fbjs@0.8.12

?[0m?[0m
?[0m?[0;4mnode_modules/fbjs/lib/minBy.js.flow:27?[0m?[0m
?[0m?[0;1m 27: ?[0m?[0m    if (!seenFirst || ?[0m?[31mcompare(b, (minB: any))?[0m?[0m < 0) {?[0m?[0;1m
                           ^^^^^^^^^^^^^^^^^^^^^^^ function call. Function cannot be called on possibly null value?[0m?[0m?[0m?[0m
?[0m?[0;1m 27: ?[0m?[0m    if (!seenFirst || ?[0m?[31mcompare?[0m?[0m(b, (minB: any)) < 0) {?[0m?[0;1m
                           ^^^^^^^ null?[0m?[0m?[0m?[0m
?[0m?[0m
?[0m?[0;4mnode_modules/fbjs/lib/minBy.js.flow:27?[0m?[0m
?[0m?[0;1m 27: ?[0m?[0m    if (!seenFirst || ?[0m?[31mcompare(b, (minB: any))?[0m?[0m < 0) {?[0m?[0;1m
                           ^^^^^^^^^^^^^^^^^^^^^^^ function call. Function cannot be called on possibly undefined value?[0m?[0m?[0m?[0m
?[0m?[0;1m 27: ?[0m?[0m    if (!seenFirst || ?[0m?[31mcompare?[0m?[0m(b, (minB: any)) < 0) {?[0m?[0;1m
                           ^^^^^^^ undefined?[0m?[0m?[0m?[0m
?[0m?[0m
?[0m
Found 17 errors

sorry for the terrible display as I’m using git-bash on a windows box

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix __DEV__ & Flow interaction #185 - facebook/fbjs - GitHub
We need this for projects consuming fbjs directly & using flow, which will check ... Make it easier for to use fbjs and...
Read more >
Dynamic Content and the Facebook JavaScript (FBJS) Library
Facebook provides an easy-to-use library for creating a richer user interface for your users via CSS both inside Facebook and outside through an ......
Read more >
Two-Faced Django Part 7: PyFacebook and FBJS Ajax - Lethain
Lets take a quick gander at the urls and views that we are reusing. First lets look at the url we are reusing...
Read more >
eslint-config-fbjs-opensource - npm package - Snyk
This configuration is a new ideal setup based on Facebook's internal configurations combined with the configurations that our open source projects are trending ......
Read more >
fbjs | Yarn - Package Manager
FBJS. Purpose. To make it easier for Facebook to share and consume our own JavaScript. Primarily this will allow us to ship code...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found