Marcus Junius Brutus Marcus Junius Brutus - 17 days ago 7
Javascript Question

Flow using directory "flow-typed" even though I've configured another [lib] value in .flowconfig

My

.flowconfig
file specifies an alternative lib directory named
decls
:

$ cat .flowconfig | grep -A1 libs
[libs]
decls/


… and I have verified that declarations are indeed picked up from there.

Yet, the presence of a
flow-typed
directory created with flow-typed causes Flow to pick up its definitions from the
flow-typed
directory instead.

I am using
flow-bin
version
0.27.0
.

Reading the main Flow documentation I found no reference to any special handling with respect to the
flow-typed
directory. The only reference to its special status is given in the the third party documentation page for flow-typed where the wording clearly states that a different directory can be used by changing the
lib
configuration in
.flowconfig
:


If you need to customize the directory where libdefs are stored in
your project, you can do so by adding a [libs] configuration to your
.flowconfig file:


Is the behaviour I am observing a bug or is it a feature that Flow will always use directory
flow-typed
(if it exists) regardless of the
[lib]
setting in
.flowconfig
?

Answer

First, it's worth noting that Flow v0.27 is pretty old. I recommend upgrading.

This function contains the special handling for flow-typed. Library locations specified under lib are used in addition to the flow-typed folder, not instead of it. It sounds like you're describing intended behavior.

Why do you want to force Flow to ignore the flow-typed folder? Why bother having the flow-typed folder at all if you want to ignore it?

Comments