flow-typed libdef with namespaced import

277 Views Asked by At

Using flow-typed for flow libdefs, it seems that namespaced imports aren't processed against the relevant libdef.

I'm unsure of the technical name for these imports so I'm using the term "namespaced imports" to refer to imports that don't destructure the core lib, but import a single function from a path.

For example, the following is checked and fails as expected:

import { flow } from 'lodash';

flow('');

This fails because flow can only accept an array of Func.

Here's the same thing but using a namespaced import:

import flow from 'lodash/flow';

flow('');

Flow does not fail this code as expected.

Is there a way to get flow to work with this type of import?

0

There are 0 best solutions below