Flow: Flow can't seem to understand export * from file

Created on 23 Mar 2018  路  7Comments  路  Source: facebook/flow

Example:

c.js

export function someFunc(){}

a.js

export * from 'c.js'

b.js

// flow says someFunc is not exported from a
import { somFunc } from 'a'

Most helpful comment

@chrissantos1995 you need to make sure every file has the // @flow comment at the top

All 7 comments

Did you tried this?

c.js

export function someFunc(){}

a.js

export * from './c.js'

b.js

// flow says someFunc is not exported from a
import { somFunc } from './a'

@TrySound to be more specific I am using yarn workspaces to include different packages across apps. This recently became an issue. I didn't used to see this error

packages/moduleA/someFile.js

export function someFunction() {}

packages/moduleA/index.js

export * from './someFile';

packages/moduleB/index.js

// Cannot import someFunction because there is no someFunction export in moduleA
import { someFunction } from 'moduleA'

I think that @TrySound was trying to say is to use the keyword function between your export and the name of your function

@GhostxRipper - sorry that was a syntax error while typing my example of the issue.

I'm getting this same error whenever using the export * from './file.js' syntax

@chrissantos1995 you need to make sure every file has the // @flow comment at the top

I lost some time today because of this. I was upgrading react-scripts regularly but I have forgotten about flow-bin. Make sure to update it to more recent version (not sure which one introduced support for this syntax).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vjpr picture vjpr  路  55Comments

danvk picture danvk  路  73Comments

Gozala picture Gozala  路  54Comments

sophiebits picture sophiebits  路  66Comments

TylerEich picture TylerEich  路  49Comments