I was playing around with all tools/technics I know to try to make Meteor and Flowtype to be friends. I made a meteor package to run flowtype checker as a linter. It works, but brings more troubles than help to my project so far. The problem is that flow does not have an easy way to declare all global libs interfaces, so when it checks my code, it of cause does not know anything about Meteor
or Session
global variables. Do I have to convert all Meteor API to an interface for Flow?
It also has troubles to understand the way we use to define global vars in Meteor.
Have anybody tried to fix this issues and how?
What you need is an interface file.
You need to do the following:
Declare the .flowconfig
file (it's automatically created when you run flow init
).
Create a folder to store your interface files that is ignored by Meteor so it doesn't try to parse it. Meteor ignores certain folder patterns, so you could try mkdir .interfaces
. Add the folder to the [libs]
section of your .flowconfig
, comme ça:
[libs]
.interfaces/
Inside, you can create declarations for your global modules. To create one for Meteor, you can try to touch .interfaces/meteor.js
and write something along these lines:
declare class Meteor {
isClient: boolean;
}
Let me know if that works. Still learning flowtype myself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With