'How to make flow auto discover `.flow` declaration files

I'm trying to get basic flow support working on a Flux project. Flux published their own .flow declaration files but for some reason flow isn't auto discovering them and all exports are getting typed as any(implicit)

I was able to get flow working correctly with 2 workarounds:

  1. Drilling down into node_modules and importing the objects from the actual file where it lives instead of importing from the top-level export.
    • This works: import ReduceStore from "flux/lib/FluxReduceStore"
    • This doesn't work: import { ReduceStore } from "flux/utils";
  2. Setting all=true in the flowconfig options. Not ideal since this opens the Pandora's box of including everything in node_modules.

Why can't flow auto discover the declaration files for top-level exports?

I prepared a full minimal reproducible example at github/thejewdude/playground-flux-flow



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source