-
Notifications
You must be signed in to change notification settings - Fork 22
Presence of .flowconfig causing module resolve issues #21
Comments
I couldn't figure out a way to tell Flow not to actually type check the library, yet still get the type definitions on module import. Removing the .flowconfig file was the way I accomplished this. There is the new "flow gen-flow-files": https://github.com/facebook/flow/releases/tag/v0.32.0 |
Being this repo experimental I didn't put much love in the distribution problem so far. I guess it's time to publish a first release. Here's my plan:
Then, as usual, one can install // @flow
import * as arr from 'flow-static-land/lib/Arr' // <= note the /lib here
arr.map(n => n * 2, arr.inj(['a'])) // <= error |
My 2 cents re: module imports: import { Monad, Monoid, Functor } from './flow-static-land'; |
That would be handy but it means you end up importing all the modules, even those which you don't actually use in your app. Another option, which seems more flexible, is to define your own prelude. So instead of: // app.js
import * as arr from 'flow-static-land/lib/Arr'
import * as maybe from 'flow-static-land/lib/Maybe'
import * as tuple from 'flow-static-land/lib/Tuple'
// your code here you first define a // prelude.js
import type { Arr } from 'flow-static-land/lib/Arr'
import type { Maybe } from 'flow-static-land/lib/Maybe'
import type { Tuple } from 'flow-static-land/lib/Tuple'
import * as arr from 'flow-static-land/lib/Arr'
import * as maybe from 'flow-static-land/lib/Maybe'
import * as tuple from 'flow-static-land/lib/Tuple'
export type {
Arr,
Maybe,
Tuple
}
export {
arr,
maybe,
tuple
} // app.js
import { arr, maybe, tuple } from './prelude'
// your code here |
Published a first version on npm (https://github.com/gcanti/flow-static-land/releases/tag/0.1.0) |
Not sure what the fix is (other than removing the .flowconfig file on a build step), but wanted to bring this to your attention.
Flow 0.32.0
Error:
Files:
test.zip
Read up on something similar here: facebook/flow#1891
Before removing .flowconfig in /node_modules/flow-static-land/
After removing .flowconfig in /node_modules/flow-static-land/
The text was updated successfully, but these errors were encountered: