Comments (25)
So if i add declare var Meteor: any;
to the files that contain the globals, the error goes away, is there anyway to do this globally for all files?
from flow.
@avikchaudhuri I tried putting it in the same folder as the other files (that reference the global), created a file called globals.js with the following:
/* @flow */
declare var Meteor: any;
But still got the same error, the other thing i was thinking, should I set the --lib property with an absolute path like we have to do .flowconfig for ignore
/ include
? I haven't tried that, I will now just in case.
from flow.
It seems to me that the solution is not to rely on globals but to use modules instead? Unless Meteor is being imported via a module loader?
from flow.
@briandipalma Well Meteor doesn't quite work that way (the environment provides a Meteor
object on the client/server), but flow needs to have a way to define globals for it, while they may not be best practice it's something that a lot of applications are going to have.
from flow.
@josebalius Could you try again putting lib outside .? Maybe putting it in the same directory as source files is making Flow clobber the information that it is a global? :/ Will investigate, also let us know if the workaround doesn't work.
from flow.
No, what I mean is, put globals.js somewhere outside the folder which contains your regular files.
from flow.
@avikchaudhuri okay just tried that as well and no luck :(
from flow.
@josebalius I ran into the same problem, then saw in the documentation that you need to specify the --lib argument even when running the check command. For example:
flow start --lib ../lib
flow check --lib ../lib
from flow.
@Eric-Wright thank you! that definitely fixed it :)
I think we can close this issue now, but it should be documented that you have to keep specifying the --lib argument when running flow check
from flow.
It would be nice if flow allowed you to run flow --lib ./lib
without having to do a full flow check
it's so slow....
from flow.
@josebalius if you run flow start --lib ./lib
and then run flow
it will use the lib.
from flow.
@tcoopman you sure? if I run it like that, i get the global errors, it does not have the same result as flow check --lib ./lib
from flow.
@josebalius just tested it with 0.1.1 and this works.
Are you sure the lib file get parsed correctly?
from flow.
@tcoopman It worked for you :( you don't get global errors? I think it is, i mean it works with flow check
and i thought lib was supposed to be a folder?
from flow.
Yeah it has to be a folder. So you first run flow start --lib lib/
and
then flow
?
Maybe try again on a test directory to see that there is nothing wrong with
something else?
On Fri, 21 Nov 2014 21:59 Jose Garcia [email protected] wrote:
@tcoopman https://github.com/tcoopman It worked for you :( you don't
get global errors? I think it is, i mean it works with flow check and i
thought lib was supposed to be a folder?—
Reply to this email directly or view it on GitHub
#45 (comment).
from flow.
@tcoopman just verified it. Also verified I had version 0.1.1 just to double check and i do. Here is what i did:
File structure:
drwxr-xr-x 3 jgarcia staff 102 Nov 22 20:08 lib
-rw-r--r-- 1 jgarcia staff 30 Nov 22 20:08 test.js
test.js
TestGlobal.run();
lib
-rw-r--r-- 1 jgarcia staff 29 Nov 22 20:08 global.js
global.js
declare var TestGlobal: any;
Test:
flow init
------------
flow start --lib ./lib
flow
/Users/jgarcia/Sites/flow-test/test.js:2:1,10: identifier TestGlobal
Unknown global name
Found 1 error
---------
flow start lib ./lib
flow check --lib ./lib
Found 0 errors
Let me know if you can reproduce.
from flow.
I've taken your exact example and cannot reproduce:
flow init
flow start --lib ./lib
flow
No errors!
(Running it like without --lib does give an error)
I'm on Linux, maybe that could be the problem?
Also can you test this:
flow start --lib ./lib
flow status
What's the full output of flow status
?
from flow.
~/Sites/flow-test
▶ flow start --lib ./lib
Spawned flow server (child pid=22957)
Logs will go to /var/folders/9k/tr3kf4zn70d5cbp8kzzdzjqw0000gp/T/flow_jgarcia/jgarcia-zSUserszSjgarciazSSiteszSflow-test.log
~/Sites/flow-test
▶ flow status
/Users/jgarcia/Sites/flow-test/test.js:2:1,10: identifier TestGlobal
Unknown global name
Found 1 error
from flow.
I thought that maybe the server stopped, I've had this happen once, but it looks like it is still running.
Maybe someone else on a Mac can check if they have the same problem?
from flow.
Anyone else? :/
from flow.
Mayb
On Nov 25, 2014 9:46 AM, "Jose Garcia" [email protected] wrote:
Anyone else? :/
—
Reply to this email directly or view it on GitHub
#45 (comment).
from flow.
@pizana68 are you having the same problem?
from flow.
@avikchaudhuri @tcoopman so I tried setting the --lib option in flow start
with an absolute path instead of relative, and it works!
from flow.
@josebalius can this issue be closed?
from flow.
@tcoopman yes sir :)
from flow.
Related Issues (20)
- Bad error message with underconstrained-implicit-instantiation and function overload HOT 4
- Incorrect node location HOT 2
- Default value seems to be ignored
- Array.prototype.filter on non-refined nullable elements leads to unhelpful error message HOT 2
- Question about union/intersection types AST HOT 3
- Crash when parse hashbang with `{tokens: true}`
- Packages entry points support
- Cannot resolve module node:fs HOT 1
- Record types should refine Object.values HOT 2
- [flow-remove-types] doesn't remove some types HOT 1
- flow_parser.js file increased from 0.7M to 2.7M in v0.210 HOT 4
- `Omit` does not work well with unions HOT 3
- ☂️ Known unsoundness issues
- Partial type does not accept plain empty object literal as a default HOT 5
- Cannot return class type as T: Cannot return `root(...)` because a call signature declaring the expected parameter / return type is missing in `SomeModel` [1] but exists in function type [2].Flow(prop-missing) HOT 2
- Does not narrow down type after undefined/falsy check HOT 1
- Recursive/deep Partial HOT 2
- Bugs in negated `instanceof` expressions HOT 1
- [Question]: How to fix flowgen test after flow update HOT 3
- [Discussion]: Any plans to make Flow more interpopble with TS ecosystem? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flow.